1
0
Fork 0

For #4856 - Refactor InflationAwareFeatureTest

We previously had a test exactly for checking that "start does nothing" but we
now need to ensure that start actually is propagated to the inner feature that
is to rebind itself to the app to allow for user interactions.
master
Petru Lingurar 2019-09-06 09:06:22 +03:00 committed by Jonathan Almeida
parent 716cf3995a
commit b82024f993
1 changed files with 3 additions and 8 deletions

View File

@ -10,7 +10,6 @@ import org.junit.Test
import org.mockito.Mockito.never
import org.mockito.Mockito.spy
import org.mockito.Mockito.verify
import org.mockito.Mockito.verifyNoMoreInteractions
import java.lang.ref.WeakReference
class InflationAwareFeatureTest {
@ -58,18 +57,14 @@ class InflationAwareFeatureTest {
}
@Test
fun `start does nothing`() {
val stub: ViewStub = mock()
val inflationFeature: InflationAwareFeature = spy(TestableInflationAwareFeature(stub))
fun `start should be delegated to the inner feature`() {
val inflationFeature: InflationAwareFeature = spy(TestableInflationAwareFeature(mock()))
val innerFeature: LifecycleAwareFeature = mock()
inflationFeature.feature = innerFeature
inflationFeature.view = WeakReference(mock())
inflationFeature.start()
verifyNoMoreInteractions(innerFeature)
verifyNoMoreInteractions(stub)
verify(innerFeature).start()
}
@Test