-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KL-72/test: add city service test code
- Loading branch information
1 parent
5d6a1c4
commit 793bda8
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/test/java/taco/klkl/domain/region/service/CityServiceImplTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |