@Test
fun onFetchUserInfoSuccessMinCaseTest() {
// UseCase͕ฦ͢ΛϞοΫ
val userEntity = UserEntity(name = "kirimin", location = null, company = null, blog = null, email = null,
avatar_url = null)
val repoEntity = RepositoryEntity()
Mockito.`when`(useCaseMock.fetchUserInfo("kirimin")).thenReturn(Single.just(User(userEntity, listOf(repoEnti
presenter.onCreate()
presenter.onSubmitButtonClick("kirimin")
verify(viewMock, times(1)).setProgressBarVisibility(View.GONE)
verify(viewMock, times(1)).setParentLayoutVisibility(View.VISIBLE)
verify(viewMock, times(1)).setUserName("kirimin")
verify(viewMock, times(1)).setLocationTextAndVisibility(eq(View.GONE), anyString())
verify(viewMock, times(1)).setMailTextAndVisibility(eq(View.GONE), anyString())
verify(viewMock, times(1)).setLinkTextAndVisibility(eq(View.GONE), anyString())
verify(viewMock, times(1)).setIconVisibility(View.INVISIBLE)
}
@Test
fun onFetchUserInfoMaxCaseTest() {
// UseCase͕ฦ͢ΛϞοΫ
val userEntity = UserEntity(name = "kirimin", location = "tokyo, japan", company = "kirimin inc.", blog = "h
kirimin.me", email = "
[email protected]", avatar_url = "http://kirimin.me/face_icon.png")
val repoEntity = RepositoryEntity()
Mockito.`when`(useCaseMock.fetchUserInfo("kirimin")).thenReturn(Single.just(User(userEntity, listOf(repoEnti
presenter.onCreate()
presenter.onSubmitButtonClick("kirimin")
verify(viewMock, times(1)).setProgressBarVisibility(View.GONE)
verify(viewMock, times(1)).setParentLayoutVisibility(View.VISIBLE)
verify(viewMock, times(1)).setUserName("kirimin")
verify(viewMock, times(1)).setLocationTextAndVisibility(View.VISIBLE, "tokyo, japan")
verify(viewMock, times(1)).setMailTextAndVisibility(View.VISIBLE, "
[email protected]")
verify(viewMock, times(1)).setLinkTextAndVisibility(View.VISIBLE, "http://kirimin.me")
verify(viewMock, times(1)).setIconVisibility(View.VISIBLE)
verify(viewMock, times(1)).setIcon("http://kirimin.me/face_icon.png")
}
σʔλͷύλʔϯ͝ͱʹ
ςετϝιουΛॻ͍͍ͯΔ
ͦΕͧΕͷςετͰ
ॏෳίʔυΛॻ͍ͯΔ
σʔλύλʔϯ
ঢ়ଶ͕૿͑Δ΄Ͳ
ςετίʔυ͕ංେԽ͢Δ