You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
src/main/kotlin/...에 있는 JVM 모듈 소스(core:domain, core:common)는 src/test/kotlin/...에 둔다.
src/main/java/...에 있는 Android 라이브러리 소스(feature:home, feature:entry, core:data)는 src/test/java/...에 둔다.
패키지 경로는 대상 클래스와 동일하게 미러링한다.
네이밍
파일명은 <대상클래스>Test.kt로 쓴다.
테스트 함수명은 백틱으로 감싼 영어 서술형을 쓴다.
Given/When/Then 주석은 쓰지 않고 빈 줄로 구획한다.
@Test
fun`invoke returns courses from repository`() {
val repository = mockk<CourseRepository>()
val expected =listOf(mockk<Course>())
every { repository.getCourses() } returns expected
val useCase =GetCoursesUseCase(repository)
val result = useCase()
assertEquals(expected, result)
}