Skip to content

Commit

Permalink
test : (Gym) Test Code 보완
Browse files Browse the repository at this point in the history
  • Loading branch information
GBGreenBravo committed Mar 21, 2024
1 parent c20edd5 commit 4cb3751
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import static org.junit.jupiter.api.Assertions.assertFalse;
Expand Down Expand Up @@ -118,6 +119,27 @@ void when_EveryGymDoesNotContainsSearchWordInTitle_Then_EmptyList() {
.findByNameContainingOrAddressContainingOrRoadAddressContaining(anyString(), anyString(), anyString());
}

@Test
@DisplayName("주어진 좌표 범위 내에 있는 암장 리스트를 반환한다.")
void when_GymsInAreaGrid_Then_ReturnGymList() {
// given
Double bottom = 37.5;
Double top = 37.6;
Double left = 127.0;
Double right = 127.1;
List<Gym> gyms = List.of(createGym(1L).build().get(), createGym(2L).build().get());

given(gymRepository.findByLatitudeBetweenAndLongitudeBetweenOrderByLikeCount(bottom, top, left, right))
.willReturn(gyms);

// when
gymReader.findGymsInAreaGrid(Map.of("bottom", bottom, "top", top, "left", left, "right", right));

// then
then(gymRepository).should(times(1))
.findByLatitudeBetweenAndLongitudeBetweenOrderByLikeCount(bottom, top, left, right);
}

@Test
@DisplayName("존재하는 (userId와 gymId로 구성된) 암장좋아요PK가 들어오면, true를 반환한다.")
void when_ExistingGymLikePK_Then_ReturnTrue() {
Expand Down

0 comments on commit 4cb3751

Please sign in to comment.