From b82024f9930d505e85da229ac4c9931b371b8879 Mon Sep 17 00:00:00 2001 From: Petru Lingurar Date: Fri, 6 Sep 2019 09:06:22 +0300 Subject: [PATCH] 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. --- .../fenix/components/InflationAwareFeatureTest.kt | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/src/test/java/org/mozilla/fenix/components/InflationAwareFeatureTest.kt b/app/src/test/java/org/mozilla/fenix/components/InflationAwareFeatureTest.kt index 28a67dda6..8cf4eaa27 100644 --- a/app/src/test/java/org/mozilla/fenix/components/InflationAwareFeatureTest.kt +++ b/app/src/test/java/org/mozilla/fenix/components/InflationAwareFeatureTest.kt @@ -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