diff --git a/core/src/test/java/greencity/controller/AchievementControllerTest.java b/core/src/test/java/greencity/controller/AchievementControllerTest.java index 4afde62828..6a662dd4dc 100644 --- a/core/src/test/java/greencity/controller/AchievementControllerTest.java +++ b/core/src/test/java/greencity/controller/AchievementControllerTest.java @@ -63,4 +63,18 @@ void findAllUnAchievedTest() throws Exception { .andExpect(status().isOk()); verify(achievementService).findAllByType("test@gmail.com", "UNACHIEVED"); } + + @Test + void findAllAchievedIgnoreCaseTest() throws Exception { + mockMvc.perform(get(achievementLink).principal(principal).param("achievementStatus", "AchieVED")) + .andExpect(status().isOk()); + verify(achievementService).findAllByType("test@gmail.com", "AchieVED"); + } + + @Test + void findAllUnAchievedIgnoreCaseTest() throws Exception { + mockMvc.perform(get(achievementLink).principal(principal).param("achievementStatus", "unAchieVED")) + .andExpect(status().isOk()); + verify(achievementService).findAllByType("test@gmail.com", "unAchieVED"); + } } diff --git a/service/src/main/java/greencity/service/AchievementServiceImpl.java b/service/src/main/java/greencity/service/AchievementServiceImpl.java index c92476cf85..b174cec743 100644 --- a/service/src/main/java/greencity/service/AchievementServiceImpl.java +++ b/service/src/main/java/greencity/service/AchievementServiceImpl.java @@ -117,9 +117,9 @@ private List findAll() { public List findAllByType(String principalEmail, String achievementStatus) { User currentUser = modelMapper.map(userService.findByEmail(principalEmail), User.class); Long userId = currentUser.getId(); - if (ACHIEVED.equals(achievementStatus)) { + if (ACHIEVED.equalsIgnoreCase(achievementStatus)) { return findAllAchieved(userId); - } else if (UNACHIEVED.equals(achievementStatus)) { + } else if (UNACHIEVED.equalsIgnoreCase(achievementStatus)) { return achievementRepo.searchAchievementsUnAchieved(userId).stream() .map(achieve -> modelMapper.map(achieve, AchievementVO.class)) .collect(Collectors.toList());