[JAVA-14174] Renamed paterns to paterns-module (#12718)
* [JAVA-14174] Renamed paterns to paterns-module * [JAVA-14174] naming fixes Co-authored-by: panagiotiskakos <panagiotis.kakos@libra-is.com>
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
package com.baeldung.pattern.cleanarchitecture.usercreation;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
|
||||
import com.baeldung.pattern.cleanarchitecture.usercreation.UserResponseFormatter;
|
||||
import com.baeldung.pattern.cleanarchitecture.usercreation.UserResponseModel;
|
||||
|
||||
class UserResponseFormatterUnitTest {
|
||||
|
||||
UserResponseFormatter userResponseFormatter = new UserResponseFormatter();
|
||||
|
||||
@Test
|
||||
void givenDateAnd3HourTime_whenPrepareSuccessView_thenReturnOnly3HourTime() {
|
||||
UserResponseModel modelResponse = new UserResponseModel("baeldung", "2020-12-20T03:00:00.000");
|
||||
UserResponseModel formattedResponse = userResponseFormatter.prepareSuccessView(modelResponse);
|
||||
|
||||
assertThat(formattedResponse.getCreationTime()).isEqualTo("03:00:00");
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenPrepareFailView_thenThrowHttpConflictException() {
|
||||
assertThatThrownBy(() -> userResponseFormatter.prepareFailView("Invalid password"))
|
||||
.isInstanceOf(ResponseStatusException.class);
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.baeldung.pattern.cleanarchitecture.usercreation;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class UserUnitTest {
|
||||
|
||||
@Test
|
||||
void given123Password_whenPasswordIsNotValid_thenIsFalse() {
|
||||
User user = new CommonUser("Baeldung", "123");
|
||||
|
||||
assertThat(user.passwordIsValid()).isFalse();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user