Skip to content

Commit

Permalink
KL-72/test: add city service test code
Browse files Browse the repository at this point in the history
  • Loading branch information
idealflower-k committed Aug 1, 2024
1 parent 5d6a1c4 commit 793bda8
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package taco.klkl.domain.region.service;

import static org.assertj.core.api.Assertions.*;
import static org.mockito.Mockito.*;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

import taco.klkl.domain.region.dao.CityRepository;

@ExtendWith(MockitoExtension.class)
public class CityServiceImplTest {

@InjectMocks
CityServiceImpl cityService;

@Mock
CityRepository cityRepository;

@Test
@DisplayName("id로 도시 존재 여부 확인 테스트")
void isExitsCity_True() {
// given
when(cityRepository.existsById(1L)).thenReturn(true);

// when
boolean result = cityService.exitsCityById(1L);

// then
assertThat(result).isTrue();
}
}

0 comments on commit 793bda8

Please sign in to comment.