Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ospodaryk committed Oct 12, 2023
1 parent e911875 commit 193df33
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,16 @@ void findAllACHIEVEDInRepoTest() {
@Test
void findAllUNACHIEVEDInRepoTest() {
when(userService.findByEmail("[email protected]")).thenReturn(ModelUtils.getUserVO());
when(achievementRepo.findAll()).thenReturn(Arrays.asList(ModelUtils.getAchievement()));
when(modelMapper.map(ModelUtils.getUserVO(), User.class)).thenReturn(ModelUtils.getUser());
when(userAchievementRepo.getUserAchievementByUserId(anyLong()))
.thenReturn(Arrays.asList(ModelUtils.getUserAchievement()));
when(achievementRepo.findById(anyLong())).thenReturn(Optional.of(ModelUtils.getAchievement()));
when(achievementRepo.searchAchievementsUnAchieved(anyLong()))
.thenReturn(Arrays.asList(ModelUtils.getAchievement()));
when(modelMapper.map(ModelUtils.getAchievement(), AchievementVO.class))
.thenReturn(ModelUtils.getAchievementVO());
List<AchievementVO> findAllResult = achievementService.findAllByType("[email protected]", "UNACHIEVED");
assertTrue(findAllResult.isEmpty());
assertEquals(1L, (long) findAllResult.get(0).getId());
verify(userService).findByEmail("[email protected]");
verify(modelMapper).map(ModelUtils.getUserVO(), User.class);
verify(userAchievementRepo).getUserAchievementByUserId(anyLong());
verify(modelMapper, times(2)).map(ModelUtils.getAchievement(), AchievementVO.class);
verify(achievementRepo).searchAchievementsUnAchieved(anyLong());
}

@Test
Expand Down

0 comments on commit 193df33

Please sign in to comment.