diff --git a/src/main/java/com/diareat/diareat/food/service/FoodService.java b/src/main/java/com/diareat/diareat/food/service/FoodService.java index 9e9a315..04fa086 100644 --- a/src/main/java/com/diareat/diareat/food/service/FoodService.java +++ b/src/main/java/com/diareat/diareat/food/service/FoodService.java @@ -47,7 +47,7 @@ public Long saveFood(CreateFoodDto createFoodDto) { } // 회원이 특정 날짜에 먹은 음식 조회 - @Cacheable(value = "ResponseFoodDto", key = "#userId+#date", cacheManager = "diareatCacheManager") + @Cacheable(value = "ResponseFoodDto", key = "#userId+#date.toString()", cacheManager = "diareatCacheManager") @Transactional(readOnly = true) public List getFoodListByDate(Long userId, LocalDate date){ validateUser(userId); diff --git a/src/test/java/com/diareat/diareat/controller/FoodControllerTest.java b/src/test/java/com/diareat/diareat/controller/FoodControllerTest.java index 413d53f..57cbba7 100644 --- a/src/test/java/com/diareat/diareat/controller/FoodControllerTest.java +++ b/src/test/java/com/diareat/diareat/controller/FoodControllerTest.java @@ -96,7 +96,10 @@ void testSaveFood() throws Exception { @WithMockUser("test") void testGetFoodListByDate() throws Exception { //Given - LocalDate date = LocalDate.now(); + int yy = 2023; + int dd = 22; + int mm = 12; + LocalDate date = LocalDate.of(yy, mm, dd); ResponseFoodDto food1 = ResponseFoodDto.of(testFoodId, testUserId,"test", LocalDate.now(), LocalTime.now(),testBaseNutrition,false);