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
parent
716cf3995a
commit
b82024f993
|
@ -10,7 +10,6 @@ import org.junit.Test
|
||||||
import org.mockito.Mockito.never
|
import org.mockito.Mockito.never
|
||||||
import org.mockito.Mockito.spy
|
import org.mockito.Mockito.spy
|
||||||
import org.mockito.Mockito.verify
|
import org.mockito.Mockito.verify
|
||||||
import org.mockito.Mockito.verifyNoMoreInteractions
|
|
||||||
import java.lang.ref.WeakReference
|
import java.lang.ref.WeakReference
|
||||||
|
|
||||||
class InflationAwareFeatureTest {
|
class InflationAwareFeatureTest {
|
||||||
|
@ -58,18 +57,14 @@ class InflationAwareFeatureTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `start does nothing`() {
|
fun `start should be delegated to the inner feature`() {
|
||||||
val stub: ViewStub = mock()
|
val inflationFeature: InflationAwareFeature = spy(TestableInflationAwareFeature(mock()))
|
||||||
val inflationFeature: InflationAwareFeature = spy(TestableInflationAwareFeature(stub))
|
|
||||||
val innerFeature: LifecycleAwareFeature = mock()
|
val innerFeature: LifecycleAwareFeature = mock()
|
||||||
|
|
||||||
inflationFeature.feature = innerFeature
|
inflationFeature.feature = innerFeature
|
||||||
inflationFeature.view = WeakReference(mock())
|
|
||||||
|
|
||||||
inflationFeature.start()
|
inflationFeature.start()
|
||||||
|
|
||||||
verifyNoMoreInteractions(innerFeature)
|
verify(innerFeature).start()
|
||||||
verifyNoMoreInteractions(stub)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue