-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding update user with profiles (#174)
Co-authored-by: ElisKina-dev <[email protected]>
- Loading branch information
1 parent
61b96aa
commit 9115929
Showing
10 changed files
with
95 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,18 +167,13 @@ void testInsertUserExceptionCase() { | |
|
||
@Test | ||
void testUpdateUser() { | ||
UserInsertionDTO dto = new UserInsertionDTO(); | ||
dto.setUserId("[email protected]"); | ||
dto.setName("Paolo"); | ||
dto.setSurname("Rossi"); | ||
|
||
User user = new User(); | ||
user.setUserId(dto.getUserId()); | ||
user.setUserId("[email protected]"); | ||
|
||
when(userServiceImpl.getById(any(String.class))).thenReturn(Uni.createFrom().item(user)); | ||
when(userRepository.persist(any(User.class))).thenReturn(Uni.createFrom().item(user)); | ||
|
||
userServiceImpl.updateUser(dto).subscribe().withSubscriber(UniAssertSubscriber.create()) | ||
userServiceImpl.updateUser("[email protected]", "Paolo", "Rossi").subscribe().withSubscriber(UniAssertSubscriber.create()) | ||
.assertCompleted() | ||
.assertItem(user); | ||
|
||
|
@@ -187,18 +182,13 @@ void testUpdateUser() { | |
|
||
@Test | ||
void testUpdateUserSuccessPartialNameOnly() { | ||
UserInsertionDTO dto = new UserInsertionDTO(); | ||
dto.setUserId("[email protected]"); | ||
dto.setName("Paolo"); | ||
dto.setSurname(""); | ||
|
||
User user = new User(); | ||
user.setUserId(dto.getUserId()); | ||
user.setUserId("[email protected]"); | ||
|
||
when(userServiceImpl.getById(any(String.class))).thenReturn(Uni.createFrom().item(user)); | ||
when(userRepository.persist(any(User.class))).thenReturn(Uni.createFrom().item(user)); | ||
|
||
userServiceImpl.updateUser(dto).subscribe().withSubscriber(UniAssertSubscriber.create()) | ||
userServiceImpl.updateUser("[email protected]", "Paolo", "Rossi").subscribe().withSubscriber(UniAssertSubscriber.create()) | ||
.assertCompleted() | ||
.assertItem(user); | ||
|
||
|
@@ -207,39 +197,18 @@ void testUpdateUserSuccessPartialNameOnly() { | |
|
||
@Test | ||
void testUpdateUserSuccessPartialSurnameOnly() { | ||
UserInsertionDTO dto = new UserInsertionDTO(); | ||
dto.setUserId("[email protected]"); | ||
dto.setName(""); | ||
dto.setSurname("Rossi"); | ||
|
||
User user = new User(); | ||
user.setUserId(dto.getUserId()); | ||
user.setUserId("[email protected]"); | ||
|
||
when(userServiceImpl.getById(any(String.class))).thenReturn(Uni.createFrom().item(user)); | ||
when(userRepository.persist(any(User.class))).thenReturn(Uni.createFrom().item(user)); | ||
|
||
userServiceImpl.updateUser(dto).subscribe().withSubscriber(UniAssertSubscriber.create()) | ||
userServiceImpl.updateUser("[email protected]", "Paolo", "Rossi").subscribe().withSubscriber(UniAssertSubscriber.create()) | ||
.assertCompleted() | ||
.assertItem(user); | ||
|
||
} | ||
|
||
@Test | ||
void testUpdateUserErrorAllFieldsBlank() { | ||
UserInsertionDTO dto = new UserInsertionDTO(); | ||
dto.setUserId(""); | ||
dto.setName(""); | ||
dto.setSurname(""); | ||
|
||
when(userServiceImpl.getById(any(String.class))).thenReturn(Uni.createFrom().item(new User())); | ||
|
||
userServiceImpl.updateUser(dto).subscribe().withSubscriber(UniAssertSubscriber.create()) | ||
.assertFailed() | ||
.assertFailedWith(AtmLayerException.class, "Tutti i campi sono vuoti"); | ||
|
||
verify(userRepository, never()).persist(any(User.class)); | ||
} | ||
|
||
@Test | ||
void testGetById() { | ||
String userId = "existentId"; | ||
|