File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
src/test/java/com/example/code/domain/model Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .example .code .domain .model ;
2+
3+ import static com .example .code .utils .UserGenerator .createUserCreationDto ;
4+ import static com .example .code .utils .UserGenerator .createUserModificationDto ;
5+ import static org .assertj .core .api .AssertionsForClassTypes .assertThat ;
6+
7+ import com .example .code .utils .UserGenerator ;
8+ import org .junit .jupiter .api .Test ;
9+
10+ public class UserTest {
11+
12+ @ Test
13+ void createUser () {
14+ // Given
15+ final var userCreationDto = createUserCreationDto ();
16+ // When
17+ final var user = User .create (userCreationDto );
18+ // Then
19+ assertThat (user ).isNotNull ();
20+ assertThat (user .getName ()).isEqualTo (userCreationDto .getName ());
21+ assertThat (user .getSurname ()).isEqualTo (userCreationDto .getSurname ());
22+ assertThat (user .getAddress ()).isEqualTo (userCreationDto .getAddress ());
23+ assertThat (user .getCity ()).isEqualTo (userCreationDto .getCity ());
24+ assertThat (user .getEmail ()).isEqualTo (userCreationDto .getEmail ());
25+ }
26+
27+ @ Test
28+ void modifyUser () {
29+ // Given
30+ final var userModificationDto = createUserModificationDto ();
31+ final var user = UserGenerator .createUser ();
32+ // When
33+ user .modify (userModificationDto );
34+ // Then
35+ assertThat (user ).isNotNull ();
36+ assertThat (user .getName ()).isEqualTo (userModificationDto .getName ());
37+ assertThat (user .getSurname ()).isEqualTo (userModificationDto .getSurname ());
38+ assertThat (user .getAddress ()).isEqualTo (userModificationDto .getAddress ());
39+ assertThat (user .getCity ()).isEqualTo (userModificationDto .getCity ());
40+ assertThat (user .getEmail ()).isEqualTo (userModificationDto .getEmail ());
41+ }
42+ }
You can’t perform that action at this time.
0 commit comments