diff --git a/service/src/test/java/greencity/service/EventServiceImplTest.java b/service/src/test/java/greencity/service/EventServiceImplTest.java index 266b486bd..49bc96224 100644 --- a/service/src/test/java/greencity/service/EventServiceImplTest.java +++ b/service/src/test/java/greencity/service/EventServiceImplTest.java @@ -26,6 +26,7 @@ import greencity.entity.event.Address; import greencity.entity.event.Event; import greencity.entity.event.EventDateLocation; +import greencity.entity.event.EventGrade; import greencity.entity.event.EventImages; import greencity.enums.NotificationType; import greencity.enums.Role; @@ -513,7 +514,7 @@ void getEventWithoutUser() { assertEquals(eventDto.getTitleImage(), actual.getTitleImage()); assertFalse(actual.isSubscribed()); assertFalse(actual.isFavorite()); - + assertNull(actual.getCurrentUserGrade()); verify(eventRepo, never()).findFavoritesAmongEventIds(anyList(), anyLong()); verify(eventRepo, never()).findSubscribedAmongEventIds(anyList(), anyLong()); } @@ -526,6 +527,8 @@ void getEventWithCurrentUser() { Principal principal = ModelUtils.getPrincipal(); User user = ModelUtils.getUser(); + event.setEventGrades(List.of(EventGrade.builder().grade(5).user(user).event(event).build())); + when(modelMapper.map(testUserVo, User.class)).thenReturn(user); when(restClient.findByEmail(principal.getName())).thenReturn(testUserVo); when(eventRepo.findById(anyLong())).thenReturn(Optional.of(event)); @@ -537,7 +540,7 @@ void getEventWithCurrentUser() { assertTrue(actual.isSubscribed()); assertTrue(actual.isFavorite()); - + assertEquals(5, actual.getCurrentUserGrade()); verify(eventRepo).findFavoritesAmongEventIds(eventIds, user.getId()); verify(eventRepo).findSubscribedAmongEventIds(eventIds, user.getId()); }