Simplify the creation of FakeThreadUtils and InfraIntegrationScope.
PiperOrigin-RevId: 242987703
Change-Id: Ie0ae080665fd54d11d9bc22817eb5a0e886d47a9
diff --git a/src/main/java/com/google/android/libraries/feed/common/concurrent/testing/FakeMainThreadRunner.java b/src/main/java/com/google/android/libraries/feed/common/concurrent/testing/FakeMainThreadRunner.java
index c28f5f7..403661d 100644
--- a/src/main/java/com/google/android/libraries/feed/common/concurrent/testing/FakeMainThreadRunner.java
+++ b/src/main/java/com/google/android/libraries/feed/common/concurrent/testing/FakeMainThreadRunner.java
@@ -47,9 +47,7 @@
public static FakeMainThreadRunner create(FakeClock fakeClock) {
return new FakeMainThreadRunner(
- fakeClock,
- new FakeThreadUtils(/* enforceThreadChecks= */ false),
- /* shouldQueueTasks= */ false);
+ fakeClock, FakeThreadUtils.withoutThreadChecks(), /* shouldQueueTasks= */ false);
}
public static FakeMainThreadRunner runTasksImmediately() {
@@ -64,9 +62,7 @@
public static FakeMainThreadRunner queueAllTasks() {
return new FakeMainThreadRunner(
- new FakeClock(),
- new FakeThreadUtils(/* enforceThreadChecks= */ false),
- /* shouldQueueTasks= */ true);
+ new FakeClock(), FakeThreadUtils.withoutThreadChecks(), /* shouldQueueTasks= */ true);
}
private FakeMainThreadRunner(
diff --git a/src/main/java/com/google/android/libraries/feed/common/concurrent/testing/FakeThreadUtils.java b/src/main/java/com/google/android/libraries/feed/common/concurrent/testing/FakeThreadUtils.java
index 58a1b48..7f008c6 100644
--- a/src/main/java/com/google/android/libraries/feed/common/concurrent/testing/FakeThreadUtils.java
+++ b/src/main/java/com/google/android/libraries/feed/common/concurrent/testing/FakeThreadUtils.java
@@ -21,11 +21,7 @@
private boolean isMainThread = true;
private boolean enforceThreadChecks = true;
- public FakeThreadUtils() {
- this(/* enforceThreadChecks= */ true);
- }
-
- public FakeThreadUtils(boolean enforceThreadChecks) {
+ private FakeThreadUtils(boolean enforceThreadChecks) {
this.enforceThreadChecks = enforceThreadChecks;
}
@@ -50,4 +46,14 @@
isMainThread = enforceMainThread;
return result;
}
+
+ /** Create a {@link FakeThreadUtils} with thread enforcement. */
+ public static FakeThreadUtils withThreadChecks() {
+ return new FakeThreadUtils(/* enforceThreadChecks= */ true);
+ }
+
+ /** Create a {@link FakeThreadUtils} without thread enforcement. */
+ public static FakeThreadUtils withoutThreadChecks() {
+ return new FakeThreadUtils(/* enforceThreadChecks= */ false);
+ }
}
diff --git a/src/main/java/com/google/android/libraries/feed/common/testing/InfraIntegrationScope.java b/src/main/java/com/google/android/libraries/feed/common/testing/InfraIntegrationScope.java
index 244dc99..8378267 100644
--- a/src/main/java/com/google/android/libraries/feed/common/testing/InfraIntegrationScope.java
+++ b/src/main/java/com/google/android/libraries/feed/common/testing/InfraIntegrationScope.java
@@ -124,12 +124,12 @@
feedProtocolAdapter = new FeedProtocolAdapter(timingUtils);
fakeRequestManager =
new FakeRequestManager(
- new FakeThreadUtils(/* enforceThreadChecks= */ false),
+ FakeThreadUtils.withoutThreadChecks(),
fakeMainThreadRunner,
feedProtocolAdapter,
taskQueue);
FakeActionUploadRequestManager fakeActionUploadRequestManager =
- new FakeActionUploadRequestManager(new FakeThreadUtils());
+ new FakeActionUploadRequestManager(FakeThreadUtils.withThreadChecks());
feedSessionManager =
new FeedSessionManagerFactory(
taskQueue,
@@ -221,15 +221,12 @@
private final FakeClock fakeClock = new FakeClock();
private final FakeMainThreadRunner fakeMainThreadRunner =
FakeMainThreadRunner.create(fakeClock);
- private final ThreadUtils threadUtils;
+ private final ThreadUtils threadUtils = FakeThreadUtils.withoutThreadChecks();
private Configuration configuration = Configuration.getDefaultInstance();
- private SchedulerApi schedulerApi;
+ private SchedulerApi schedulerApi = new FakeSchedulerApi(threadUtils);
- public Builder(ThreadUtils threadUtils) {
- this.threadUtils = threadUtils;
- schedulerApi = new FakeSchedulerApi(threadUtils);
- }
+ public Builder() {}
public Builder setConfiguration(Configuration configuration) {
this.configuration = configuration;
diff --git a/src/test/java/com/google/android/libraries/feed/api/scope/ClearAllListenerTest.java b/src/test/java/com/google/android/libraries/feed/api/scope/ClearAllListenerTest.java
index 370d56a..c7e348c 100644
--- a/src/test/java/com/google/android/libraries/feed/api/scope/ClearAllListenerTest.java
+++ b/src/test/java/com/google/android/libraries/feed/api/scope/ClearAllListenerTest.java
@@ -38,7 +38,7 @@
@RunWith(RobolectricTestRunner.class)
public class ClearAllListenerTest {
private final FakeClock fakeClock = new FakeClock();
- private final FakeThreadUtils fakeThreadUtils = new FakeThreadUtils();
+ private final FakeThreadUtils fakeThreadUtils = FakeThreadUtils.withThreadChecks();
@Mock private Resettable store;
@Mock private SessionManager sessionManager;
diff --git a/src/test/java/com/google/android/libraries/feed/feedactionmanager/FeedActionManagerImplTest.java b/src/test/java/com/google/android/libraries/feed/feedactionmanager/FeedActionManagerImplTest.java
index 9b949bf..dc621b7 100644
--- a/src/test/java/com/google/android/libraries/feed/feedactionmanager/FeedActionManagerImplTest.java
+++ b/src/test/java/com/google/android/libraries/feed/feedactionmanager/FeedActionManagerImplTest.java
@@ -62,7 +62,7 @@
private final FakeClock fakeClock = new FakeClock();
private final FakeMainThreadRunner fakeMainThreadRunner =
FakeMainThreadRunner.runTasksImmediately();
- private final FakeThreadUtils fakeThreadUtils = new FakeThreadUtils();
+ private final FakeThreadUtils fakeThreadUtils = FakeThreadUtils.withThreadChecks();
@Mock private SessionManager sessionManager;
@Mock private Store store;
diff --git a/src/test/java/com/google/android/libraries/feed/feedactionreader/FeedActionReaderTest.java b/src/test/java/com/google/android/libraries/feed/feedactionreader/FeedActionReaderTest.java
index 72dddae..a3b9095 100644
--- a/src/test/java/com/google/android/libraries/feed/feedactionreader/FeedActionReaderTest.java
+++ b/src/test/java/com/google/android/libraries/feed/feedactionreader/FeedActionReaderTest.java
@@ -64,7 +64,7 @@
private static final long DEFAULT_TIME = TimeUnit.DAYS.toSeconds(42);
private final FakeClock fakeClock = new FakeClock();
- private final FakeThreadUtils fakeThreadUtils = new FakeThreadUtils();
+ private final FakeThreadUtils fakeThreadUtils = FakeThreadUtils.withThreadChecks();
@Mock private Store store;
@Mock private ProtocolAdapter protocolAdapter;
diff --git a/src/test/java/com/google/android/libraries/feed/feedrequestmanager/FeedActionUploadRequestManagerTest.java b/src/test/java/com/google/android/libraries/feed/feedrequestmanager/FeedActionUploadRequestManagerTest.java
index 2a738e6..df37749 100644
--- a/src/test/java/com/google/android/libraries/feed/feedrequestmanager/FeedActionUploadRequestManagerTest.java
+++ b/src/test/java/com/google/android/libraries/feed/feedrequestmanager/FeedActionUploadRequestManagerTest.java
@@ -104,7 +104,7 @@
registry = ExtensionRegistryLite.newInstance();
registry.add(FeedRequest.feedRequest);
fakeActionReader = new FakeActionReader();
- fakeThreadUtils = new FakeThreadUtils();
+ fakeThreadUtils = FakeThreadUtils.withThreadChecks();
fakeNetworkClient = new FakeNetworkClient(fakeThreadUtils);
fakeTaskQueue = new FakeTaskQueue(MoreExecutors.directExecutor(), fakeClock, fakeThreadUtils);
fakeProtocolAdapter = new FakeProtocolAdapter();
diff --git a/src/test/java/com/google/android/libraries/feed/feedrequestmanager/FeedRequestManagerTest.java b/src/test/java/com/google/android/libraries/feed/feedrequestmanager/FeedRequestManagerTest.java
index d8164ac..c850fb9 100644
--- a/src/test/java/com/google/android/libraries/feed/feedrequestmanager/FeedRequestManagerTest.java
+++ b/src/test/java/com/google/android/libraries/feed/feedrequestmanager/FeedRequestManagerTest.java
@@ -142,7 +142,7 @@
fakeActionReader = new FakeActionReader();
fakeProtocolAdapter = new FakeProtocolAdapter();
fakeBasicLoggingApi = new FakeBasicLoggingApi();
- fakeThreadUtils = new FakeThreadUtils();
+ fakeThreadUtils = FakeThreadUtils.withThreadChecks();
fakeMainThreadRunner =
FakeMainThreadRunner.runTasksImmediatelyWithThreadChecks(fakeThreadUtils);
fakeNetworkClient = new FakeNetworkClient(fakeThreadUtils);
diff --git a/src/test/java/com/google/android/libraries/feed/feedsessionmanager/FeedSessionManagerTest.java b/src/test/java/com/google/android/libraries/feed/feedsessionmanager/FeedSessionManagerTest.java
index 7e0f605..dd3439f 100644
--- a/src/test/java/com/google/android/libraries/feed/feedsessionmanager/FeedSessionManagerTest.java
+++ b/src/test/java/com/google/android/libraries/feed/feedsessionmanager/FeedSessionManagerTest.java
@@ -122,7 +122,7 @@
@Before
public void setUp() {
initMocks(this);
- fakeThreadUtils = new FakeThreadUtils();
+ fakeThreadUtils = FakeThreadUtils.withThreadChecks();
fakeMainThreadRunner =
FakeMainThreadRunner.runTasksImmediatelyWithThreadChecks(fakeThreadUtils);
fakeTaskQueue = new FakeTaskQueue(MoreExecutors.directExecutor(), fakeClock, fakeThreadUtils);
diff --git a/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/HeadAsStructureTest.java b/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/HeadAsStructureTest.java
index a885a72..d8fd1df 100644
--- a/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/HeadAsStructureTest.java
+++ b/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/HeadAsStructureTest.java
@@ -42,7 +42,7 @@
public class HeadAsStructureTest {
private final ContentIdGenerators idGenerators = new ContentIdGenerators();
- private final FakeThreadUtils fakeThreadUtils = new FakeThreadUtils();
+ private final FakeThreadUtils fakeThreadUtils = FakeThreadUtils.withThreadChecks();
private final String rootContentId = idGenerators.createRootContentId(0);
private final TimingUtils timingUtils = new TimingUtils();
private final FakeClock fakeClock = new FakeClock();
diff --git a/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/HeadSessionImplTest.java b/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/HeadSessionImplTest.java
index b61cd23..c282c90 100644
--- a/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/HeadSessionImplTest.java
+++ b/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/HeadSessionImplTest.java
@@ -41,8 +41,7 @@
public class HeadSessionImplTest {
private final ContentIdGenerators contentIdGenerators = new ContentIdGenerators();
private final FakeClock fakeClock = new FakeClock();
- private final FakeThreadUtils fakeThreadUtils =
- new FakeThreadUtils(/* enforceThreadChecks= */ false);
+ private final FakeThreadUtils fakeThreadUtils = FakeThreadUtils.withoutThreadChecks();
private final TimingUtils timingUtils = new TimingUtils();
private FakeStore fakeStore;
diff --git a/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/SessionCacheTest.java b/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/SessionCacheTest.java
index a42f9c8..7227c1a 100644
--- a/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/SessionCacheTest.java
+++ b/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/SessionCacheTest.java
@@ -51,7 +51,7 @@
private final Configuration configuration = new Configuration.Builder().build();
private final ContentIdGenerators idGenerators = new ContentIdGenerators();
private final FakeClock fakeClock = new FakeClock();
- private final FakeThreadUtils fakeThreadUtils = new FakeThreadUtils();
+ private final FakeThreadUtils fakeThreadUtils = FakeThreadUtils.withThreadChecks();
private final TimingUtils timingUtils = new TimingUtils();
private FakeStore fakeStore;
diff --git a/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/SessionImplTest.java b/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/SessionImplTest.java
index 317a524..4c5ee12 100644
--- a/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/SessionImplTest.java
+++ b/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/SessionImplTest.java
@@ -40,7 +40,7 @@
@RunWith(RobolectricTestRunner.class)
public class SessionImplTest extends AbstractSessionImplTest {
private final FakeClock fakeClock = new FakeClock();
- private final FakeThreadUtils fakeThreadUtils = new FakeThreadUtils();
+ private final FakeThreadUtils fakeThreadUtils = FakeThreadUtils.withThreadChecks();
private final TimingUtils timingUtils = new TimingUtils();
@Before
diff --git a/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/SessionManagerMutationTest.java b/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/SessionManagerMutationTest.java
index e8353ba..54abd75 100644
--- a/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/SessionManagerMutationTest.java
+++ b/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/SessionManagerMutationTest.java
@@ -83,7 +83,7 @@
private final ContentStorageDirect contentStorage = new InMemoryContentStorage();
private final FakeBasicLoggingApi fakeBasicLoggingApi = new FakeBasicLoggingApi();
private final FakeClock fakeClock = new FakeClock();
- private final FakeThreadUtils fakeThreadUtils = new FakeThreadUtils();
+ private final FakeThreadUtils fakeThreadUtils = FakeThreadUtils.withThreadChecks();
private final FeedExtensionRegistry extensionRegistry = new FeedExtensionRegistry(ArrayList::new);
private final String rootContentId = idGenerators.createRootContentId(0);
private final TimingUtils timingUtils = new TimingUtils();
diff --git a/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/TimeoutSessionImplTest.java b/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/TimeoutSessionImplTest.java
index 93f9749..ce7d148 100644
--- a/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/TimeoutSessionImplTest.java
+++ b/src/test/java/com/google/android/libraries/feed/feedsessionmanager/internal/TimeoutSessionImplTest.java
@@ -46,7 +46,7 @@
@RunWith(RobolectricTestRunner.class)
public class TimeoutSessionImplTest extends AbstractSessionImplTest {
private final FakeClock fakeClock = new FakeClock();
- private final FakeThreadUtils fakeThreadUtils = new FakeThreadUtils();
+ private final FakeThreadUtils fakeThreadUtils = FakeThreadUtils.withThreadChecks();
private final TimingUtils timingUtils = new TimingUtils();
@Mock private ViewDepthProvider viewDepthProvider;
diff --git a/src/test/java/com/google/android/libraries/feed/feedstore/FeedStoreEphemeralModeTest.java b/src/test/java/com/google/android/libraries/feed/feedstore/FeedStoreEphemeralModeTest.java
index db7aa77..f0c12ee 100644
--- a/src/test/java/com/google/android/libraries/feed/feedstore/FeedStoreEphemeralModeTest.java
+++ b/src/test/java/com/google/android/libraries/feed/feedstore/FeedStoreEphemeralModeTest.java
@@ -41,7 +41,7 @@
public class FeedStoreEphemeralModeTest extends AbstractFeedStoreTest {
private final FakeBasicLoggingApi fakeBasicLoggingApi = new FakeBasicLoggingApi();
- private final FakeThreadUtils fakeThreadUtils = new FakeThreadUtils();
+ private final FakeThreadUtils fakeThreadUtils = FakeThreadUtils.withThreadChecks();
private final FeedExtensionRegistry extensionRegistry = new FeedExtensionRegistry(ArrayList::new);
private final ContentStorageDirect contentStorage = new InMemoryContentStorage();
diff --git a/src/test/java/com/google/android/libraries/feed/feedstore/FeedStoreTest.java b/src/test/java/com/google/android/libraries/feed/feedstore/FeedStoreTest.java
index 59e9d79..c32a66f 100644
--- a/src/test/java/com/google/android/libraries/feed/feedstore/FeedStoreTest.java
+++ b/src/test/java/com/google/android/libraries/feed/feedstore/FeedStoreTest.java
@@ -83,7 +83,7 @@
private static final byte[] SEMANTIC_PROPERTIES = new byte[] {4, 12, 18, 5};
private final ContentStorageDirect contentStorage = new InMemoryContentStorage();
- private final FakeThreadUtils fakeThreadUtils = new FakeThreadUtils();
+ private final FakeThreadUtils fakeThreadUtils = FakeThreadUtils.withThreadChecks();
private final FeedExtensionRegistry extensionRegistry = new FeedExtensionRegistry(ArrayList::new);
@Mock private BasicLoggingApi basicLoggingApi;
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/BUILD b/src/test/java/com/google/android/libraries/feed/infraintegration/BUILD
index 2f4c293..d92513c 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/BUILD
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/BUILD
@@ -108,7 +108,6 @@
"//src/main/java/com/google/android/libraries/feed/api/modelprovider",
"//src/main/java/com/google/android/libraries/feed/api/sessionmanager",
"//src/main/java/com/google/android/libraries/feed/common/concurrent",
- "//src/main/java/com/google/android/libraries/feed/common/concurrent/testing",
"//src/main/java/com/google/android/libraries/feed/common/testing",
"//src/main/java/com/google/android/libraries/feed/common/time/testing",
"//src/main/java/com/google/android/libraries/feed/host/logging",
@@ -176,7 +175,6 @@
manifest_values = DEFAULT_ANDROID_LOCAL_TEST_MANIFEST,
deps = [
"//src/main/java/com/google/android/libraries/feed/api/common",
- "//src/main/java/com/google/android/libraries/feed/common/concurrent/testing",
"//src/main/java/com/google/android/libraries/feed/common/testing",
"//src/main/java/com/google/android/libraries/feed/common/time/testing",
"//src/main/java/com/google/android/libraries/feed/host/config",
@@ -415,7 +413,6 @@
"//src/main/java/com/google/android/libraries/feed/api/sessionmanager",
"//src/main/java/com/google/android/libraries/feed/common",
"//src/main/java/com/google/android/libraries/feed/common/concurrent",
- "//src/main/java/com/google/android/libraries/feed/common/concurrent/testing",
"//src/main/java/com/google/android/libraries/feed/common/functional",
"//src/main/java/com/google/android/libraries/feed/common/testing",
"//src/main/java/com/google/android/libraries/feed/common/time/testing",
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/ClearAllTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/ClearAllTest.java
index b639e1f..3b68afb 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/ClearAllTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/ClearAllTest.java
@@ -18,7 +18,6 @@
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.android.libraries.feed.api.common.MutationContext;
-import com.google.android.libraries.feed.api.common.ThreadUtils;
import com.google.android.libraries.feed.api.lifecycle.AppLifecycleListener;
import com.google.android.libraries.feed.api.modelprovider.ModelProvider;
import com.google.android.libraries.feed.api.modelprovider.ModelProvider.State;
@@ -35,14 +34,11 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
/** This will test the behavior of clear all. */
@RunWith(RobolectricTestRunner.class)
public class ClearAllTest {
- @Mock private ThreadUtils threadUtils;
-
private FakeRequestManager requestManager;
private SessionManager sessionManager;
private ModelProviderFactory modelProviderFactory;
@@ -55,7 +51,7 @@
Configuration configuration =
new Configuration.Builder().put(ConfigKey.LIMIT_PAGE_UPDATES, false).build();
InfraIntegrationScope scope =
- new InfraIntegrationScope.Builder(threadUtils).setConfiguration(configuration).build();
+ new InfraIntegrationScope.Builder().setConfiguration(configuration).build();
requestManager = scope.getRequestManager();
sessionManager = scope.getSessionManager();
modelProviderFactory = scope.getModelProviderFactory();
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/ContentRemoveTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/ContentRemoveTest.java
index db9e3ff..81e26f3 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/ContentRemoveTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/ContentRemoveTest.java
@@ -21,7 +21,6 @@
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.android.libraries.feed.api.common.MutationContext;
-import com.google.android.libraries.feed.api.common.ThreadUtils;
import com.google.android.libraries.feed.api.modelprovider.FeatureChange;
import com.google.android.libraries.feed.api.modelprovider.FeatureChangeObserver;
import com.google.android.libraries.feed.api.modelprovider.ModelCursor;
@@ -42,14 +41,11 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
/** Tests which remove content within an existing model. */
@RunWith(RobolectricTestRunner.class)
public class ContentRemoveTest {
- @Mock private ThreadUtils threadUtils;
-
private FakeRequestManager requestManager;
private SessionManager sessionManager;
private ModelProviderFactory modelProviderFactory;
@@ -58,7 +54,7 @@
@Before
public void setUp() {
initMocks(this);
- InfraIntegrationScope scope = new InfraIntegrationScope.Builder(threadUtils).build();
+ InfraIntegrationScope scope = new InfraIntegrationScope.Builder().build();
requestManager = scope.getRequestManager();
sessionManager = scope.getSessionManager();
modelProviderFactory = scope.getModelProviderFactory();
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/ContentUpdateTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/ContentUpdateTest.java
index 846f82d..648518b 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/ContentUpdateTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/ContentUpdateTest.java
@@ -20,7 +20,6 @@
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.android.libraries.feed.api.common.MutationContext;
-import com.google.android.libraries.feed.api.common.ThreadUtils;
import com.google.android.libraries.feed.api.modelprovider.FeatureChange;
import com.google.android.libraries.feed.api.modelprovider.FeatureChangeObserver;
import com.google.android.libraries.feed.api.modelprovider.ModelChild;
@@ -44,14 +43,11 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
/** Tests which update content within an existing model. */
@RunWith(RobolectricTestRunner.class)
public class ContentUpdateTest {
- @Mock private ThreadUtils threadUtils;
-
private FakeRequestManager requestManager;
private SessionManager sessionManager;
private ProtocolAdapter protocolAdapter;
@@ -61,7 +57,7 @@
@Before
public void setUp() {
initMocks(this);
- InfraIntegrationScope scope = new InfraIntegrationScope.Builder(threadUtils).build();
+ InfraIntegrationScope scope = new InfraIntegrationScope.Builder().build();
requestManager = scope.getRequestManager();
sessionManager = scope.getSessionManager();
modelProviderFactory = scope.getModelProviderFactory();
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/DetachSessionTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/DetachSessionTest.java
index beb95a8..62eb2f8 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/DetachSessionTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/DetachSessionTest.java
@@ -17,7 +17,6 @@
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.android.libraries.feed.api.common.MutationContext;
-import com.google.android.libraries.feed.api.common.ThreadUtils;
import com.google.android.libraries.feed.api.common.testing.ContentIdGenerators;
import com.google.android.libraries.feed.api.modelprovider.ModelChild;
import com.google.android.libraries.feed.api.modelprovider.ModelProvider;
@@ -35,7 +34,6 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
/** This will test detaching a session then updating it and reattaching to it */
@@ -55,8 +53,6 @@
ResponseBuilder.createFeatureContentId(6)
};
- @Mock private ThreadUtils threadUtils;
-
private FakeRequestManager requestManager;
private SessionManager sessionManager;
private ModelProviderFactory modelProviderFactory;
@@ -70,7 +66,7 @@
Configuration configuration =
new Configuration.Builder().put(ConfigKey.LIMIT_PAGE_UPDATES, false).build();
InfraIntegrationScope scope =
- new InfraIntegrationScope.Builder(threadUtils).setConfiguration(configuration).build();
+ new InfraIntegrationScope.Builder().setConfiguration(configuration).build();
requestManager = scope.getRequestManager();
sessionManager = scope.getSessionManager();
modelProviderFactory = scope.getModelProviderFactory();
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/EmptyStreamTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/EmptyStreamTest.java
index faaa2d5..a4dba7c 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/EmptyStreamTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/EmptyStreamTest.java
@@ -27,7 +27,6 @@
import com.google.android.libraries.feed.api.modelprovider.ModelProviderObserver;
import com.google.android.libraries.feed.api.sessionmanager.SessionManager;
import com.google.android.libraries.feed.common.concurrent.TaskQueue;
-import com.google.android.libraries.feed.common.concurrent.testing.FakeThreadUtils;
import com.google.android.libraries.feed.common.testing.InfraIntegrationScope;
import com.google.android.libraries.feed.common.testing.ResponseBuilder;
import com.google.android.libraries.feed.common.testing.ResponseBuilder.WireProtocolInfo;
@@ -52,9 +51,7 @@
@Before
public void setUp() {
initMocks(this);
- InfraIntegrationScope scope =
- new InfraIntegrationScope.Builder(new FakeThreadUtils(/* enforceThreadChecks= */ false))
- .build();
+ InfraIntegrationScope scope = new InfraIntegrationScope.Builder().build();
fakeClock = scope.getFakeClock();
requestManager = scope.getRequestManager();
sessionManager = scope.getSessionManager();
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/ExistingSessionTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/ExistingSessionTest.java
index cc855f0..7a38a3f 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/ExistingSessionTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/ExistingSessionTest.java
@@ -18,7 +18,6 @@
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.android.libraries.feed.api.common.MutationContext;
-import com.google.android.libraries.feed.api.common.ThreadUtils;
import com.google.android.libraries.feed.api.modelprovider.ModelCursor;
import com.google.android.libraries.feed.api.modelprovider.ModelFeature;
import com.google.android.libraries.feed.api.modelprovider.ModelProvider;
@@ -34,14 +33,11 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
/** Tests which verify creating a new Model Provider from an existing session. */
@RunWith(RobolectricTestRunner.class)
public class ExistingSessionTest {
- @Mock private ThreadUtils threadUtils;
-
private FakeRequestManager requestManager;
private SessionManager sessionManager;
private ModelProviderFactory modelProviderFactory;
@@ -50,7 +46,7 @@
@Before
public void setUp() {
initMocks(this);
- InfraIntegrationScope scope = new InfraIntegrationScope.Builder(threadUtils).build();
+ InfraIntegrationScope scope = new InfraIntegrationScope.Builder().build();
requestManager = scope.getRequestManager();
sessionManager = scope.getSessionManager();
modelProviderFactory = scope.getModelProviderFactory();
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/FilterHeadTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/FilterHeadTest.java
index 04e0647..1fd929b 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/FilterHeadTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/FilterHeadTest.java
@@ -18,7 +18,6 @@
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.android.libraries.feed.api.common.MutationContext;
-import com.google.android.libraries.feed.api.common.ThreadUtils;
import com.google.android.libraries.feed.api.sessionmanager.SessionManager;
import com.google.android.libraries.feed.common.functional.Consumer;
import com.google.android.libraries.feed.common.functional.Function;
@@ -32,21 +31,18 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
/** Tests of the {@link SessionManager#getStreamFeaturesFromHead(Function, Consumer)} method. */
@RunWith(RobolectricTestRunner.class)
public class FilterHeadTest {
- @Mock private ThreadUtils threadUtils;
-
private FakeRequestManager requestManager;
private SessionManager sessionManager;
@Before
public void setUp() {
initMocks(this);
- InfraIntegrationScope scope = new InfraIntegrationScope.Builder(threadUtils).build();
+ InfraIntegrationScope scope = new InfraIntegrationScope.Builder().build();
requestManager = scope.getRequestManager();
sessionManager = scope.getSessionManager();
}
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/GcTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/GcTest.java
index f442d9b..5c94d31 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/GcTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/GcTest.java
@@ -18,7 +18,6 @@
import com.google.android.libraries.feed.api.common.MutationContext;
import com.google.android.libraries.feed.api.common.PayloadWithId;
-import com.google.android.libraries.feed.common.concurrent.testing.FakeThreadUtils;
import com.google.android.libraries.feed.common.testing.InfraIntegrationScope;
import com.google.android.libraries.feed.common.testing.ResponseBuilder;
import com.google.android.libraries.feed.common.time.testing.FakeClock;
@@ -48,7 +47,7 @@
private static final long LIFETIME_MS = Duration.ofHours(1).toMillis();
private final InfraIntegrationScope scope =
- new InfraIntegrationScope.Builder(new FakeThreadUtils(/* enforceThreadChecks= */ false))
+ new InfraIntegrationScope.Builder()
.setConfiguration(
new Configuration.Builder().put(ConfigKey.SESSION_LIFETIME_MS, LIFETIME_MS).build())
.build();
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/LimitedPagingTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/LimitedPagingTest.java
index e0b5504..831ed35 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/LimitedPagingTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/LimitedPagingTest.java
@@ -17,7 +17,6 @@
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.android.libraries.feed.api.common.MutationContext;
-import com.google.android.libraries.feed.api.common.ThreadUtils;
import com.google.android.libraries.feed.api.common.testing.ContentIdGenerators;
import com.google.android.libraries.feed.api.modelprovider.ModelChild;
import com.google.android.libraries.feed.api.modelprovider.ModelProvider;
@@ -33,7 +32,6 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
/** Test which verifies that multiple session page correctly when limited paging is on. */
@@ -53,8 +51,6 @@
ResponseBuilder.createFeatureContentId(6)
};
- @Mock private ThreadUtils threadUtils;
-
private FakeRequestManager requestManager;
private SessionManager sessionManager;
private ModelProviderFactory modelProviderFactory;
@@ -65,7 +61,7 @@
@Before
public void setUp() {
initMocks(this);
- InfraIntegrationScope scope = new InfraIntegrationScope.Builder(threadUtils).build();
+ InfraIntegrationScope scope = new InfraIntegrationScope.Builder().build();
requestManager = scope.getRequestManager();
sessionManager = scope.getSessionManager();
modelProviderFactory = scope.getModelProviderFactory();
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/MultiSessionPagingTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/MultiSessionPagingTest.java
index 9207ef2..a44ce11 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/MultiSessionPagingTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/MultiSessionPagingTest.java
@@ -18,7 +18,6 @@
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.android.libraries.feed.api.common.MutationContext;
-import com.google.android.libraries.feed.api.common.ThreadUtils;
import com.google.android.libraries.feed.api.common.testing.ContentIdGenerators;
import com.google.android.libraries.feed.api.modelprovider.ModelChild;
import com.google.android.libraries.feed.api.modelprovider.ModelProvider;
@@ -38,7 +37,6 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
/**
@@ -62,8 +60,6 @@
*/
@RunWith(RobolectricTestRunner.class)
public class MultiSessionPagingTest {
- @Mock private ThreadUtils threadUtils;
-
private FakeRequestManager requestManager;
private SessionManager sessionManager;
private ModelProviderFactory modelProviderFactory;
@@ -73,7 +69,7 @@
@Before
public void setUp() {
initMocks(this);
- InfraIntegrationScope scope = new InfraIntegrationScope.Builder(threadUtils).build();
+ InfraIntegrationScope scope = new InfraIntegrationScope.Builder().build();
requestManager = scope.getRequestManager();
sessionManager = scope.getSessionManager();
modelProviderFactory = scope.getModelProviderFactory();
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/RemoveTrackingBehaviorTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/RemoveTrackingBehaviorTest.java
index 5a96d3f..6ea457e 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/RemoveTrackingBehaviorTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/RemoveTrackingBehaviorTest.java
@@ -19,7 +19,6 @@
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.android.libraries.feed.api.common.MutationContext;
-import com.google.android.libraries.feed.api.common.ThreadUtils;
import com.google.android.libraries.feed.api.modelprovider.ModelProvider;
import com.google.android.libraries.feed.api.modelprovider.ModelProvider.RemoveTrackingFactory;
import com.google.android.libraries.feed.api.modelprovider.ModelProviderFactory;
@@ -42,7 +41,6 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
/** Tests of the ModelProvider RemoveTracking behavior. */
@@ -57,8 +55,6 @@
ResponseBuilder.createFeatureContentId(5),
};
- @Mock private ThreadUtils threadUtils;
-
private FakeRequestManager requestManager;
private SessionManager sessionManager;
private ModelProviderFactory modelProviderFactory;
@@ -67,7 +63,7 @@
@Before
public void setUp() {
initMocks(this);
- InfraIntegrationScope scope = new InfraIntegrationScope.Builder(threadUtils).build();
+ InfraIntegrationScope scope = new InfraIntegrationScope.Builder().build();
requestManager = scope.getRequestManager();
sessionManager = scope.getSessionManager();
modelProviderFactory = scope.getModelProviderFactory();
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/RootOnlyTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/RootOnlyTest.java
index 73a6b7e..f4b4442 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/RootOnlyTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/RootOnlyTest.java
@@ -22,7 +22,6 @@
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.android.libraries.feed.api.common.MutationContext;
-import com.google.android.libraries.feed.api.common.ThreadUtils;
import com.google.android.libraries.feed.api.modelprovider.ModelProvider;
import com.google.android.libraries.feed.api.modelprovider.ModelProvider.State;
import com.google.android.libraries.feed.api.modelprovider.ModelProviderFactory;
@@ -41,14 +40,11 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
/** Tests of a Stream with only a root. */
@RunWith(RobolectricTestRunner.class)
public class RootOnlyTest {
- @Mock private ThreadUtils threadUtils;
-
private FakeRequestManager requestManager;
private SessionManager sessionManager;
private ModelProviderValidator modelValidator;
@@ -57,7 +53,7 @@
@Before
public void setUp() {
initMocks(this);
- InfraIntegrationScope scope = new InfraIntegrationScope.Builder(threadUtils).build();
+ InfraIntegrationScope scope = new InfraIntegrationScope.Builder().build();
requestManager = scope.getRequestManager();
sessionManager = scope.getSessionManager();
modelProviderFactory = scope.getModelProviderFactory();
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/SemanticPropertiesTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/SemanticPropertiesTest.java
index b629429..7a7b484 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/SemanticPropertiesTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/SemanticPropertiesTest.java
@@ -19,7 +19,6 @@
import com.google.android.libraries.feed.api.common.MutationContext;
import com.google.android.libraries.feed.api.common.SemanticPropertiesWithId;
-import com.google.android.libraries.feed.api.common.ThreadUtils;
import com.google.android.libraries.feed.api.common.testing.ContentIdGenerators;
import com.google.android.libraries.feed.api.sessionmanager.SessionManager;
import com.google.android.libraries.feed.common.Result;
@@ -36,14 +35,11 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
/** Tests around Semantic Properties */
@RunWith(RobolectricTestRunner.class)
public class SemanticPropertiesTest {
- @Mock private ThreadUtils threadUtils;
-
private FakeRequestManager requestManager;
private SessionManager sessionManager;
private Store store;
@@ -51,7 +47,7 @@
@Before
public void setUp() {
initMocks(this);
- InfraIntegrationScope scope = new InfraIntegrationScope.Builder(threadUtils).build();
+ InfraIntegrationScope scope = new InfraIntegrationScope.Builder().build();
requestManager = scope.getRequestManager();
sessionManager = scope.getSessionManager();
store = scope.getStore();
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/SharedStateTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/SharedStateTest.java
index ece3f21..870d9a8 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/SharedStateTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/SharedStateTest.java
@@ -18,7 +18,6 @@
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.android.libraries.feed.api.common.MutationContext;
-import com.google.android.libraries.feed.api.common.ThreadUtils;
import com.google.android.libraries.feed.api.modelprovider.ModelProvider;
import com.google.android.libraries.feed.api.modelprovider.ModelProviderFactory;
import com.google.android.libraries.feed.api.protocoladapter.ProtocolAdapter;
@@ -32,14 +31,11 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
/** Tests of accessing shared state. */
@RunWith(RobolectricTestRunner.class)
public class SharedStateTest {
- @Mock private ThreadUtils threadUtils;
-
private FakeRequestManager requestManager;
private SessionManager sessionManager;
private ProtocolAdapter protocolAdapter;
@@ -49,7 +45,7 @@
@Before
public void setUp() {
initMocks(this);
- InfraIntegrationScope scope = new InfraIntegrationScope.Builder(threadUtils).build();
+ InfraIntegrationScope scope = new InfraIntegrationScope.Builder().build();
requestManager = scope.getRequestManager();
sessionManager = scope.getSessionManager();
modelProviderFactory = scope.getModelProviderFactory();
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/SimpleStreamTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/SimpleStreamTest.java
index a555525..cc66313 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/SimpleStreamTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/SimpleStreamTest.java
@@ -18,7 +18,6 @@
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.android.libraries.feed.api.common.MutationContext;
-import com.google.android.libraries.feed.api.common.ThreadUtils;
import com.google.android.libraries.feed.api.modelprovider.ModelChild;
import com.google.android.libraries.feed.api.modelprovider.ModelCursor;
import com.google.android.libraries.feed.api.modelprovider.ModelFeature;
@@ -36,14 +35,11 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
/** Simple tests of a stream with multiple cards. */
@RunWith(RobolectricTestRunner.class)
public class SimpleStreamTest {
- @Mock private ThreadUtils threadUtils;
-
private FakeRequestManager requestManager;
private SessionManager sessionManager;
private ModelProviderFactory modelProviderFactory;
@@ -53,7 +49,7 @@
@Before
public void setUp() {
initMocks(this);
- InfraIntegrationScope scope = new InfraIntegrationScope.Builder(threadUtils).build();
+ InfraIntegrationScope scope = new InfraIntegrationScope.Builder().build();
requestManager = scope.getRequestManager();
sessionManager = scope.getSessionManager();
modelProviderFactory = scope.getModelProviderFactory();
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/StreamPagingTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/StreamPagingTest.java
index d2c2e2e..7700dd1 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/StreamPagingTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/StreamPagingTest.java
@@ -20,7 +20,6 @@
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.android.libraries.feed.api.common.MutationContext;
-import com.google.android.libraries.feed.api.common.ThreadUtils;
import com.google.android.libraries.feed.api.common.testing.ContentIdGenerators;
import com.google.android.libraries.feed.api.modelprovider.ModelChild;
import com.google.android.libraries.feed.api.modelprovider.ModelCursor;
@@ -42,14 +41,11 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
/** Test of handling paging operations within the Stream. */
@RunWith(RobolectricTestRunner.class)
public class StreamPagingTest {
- @Mock private ThreadUtils threadUtils;
-
private FakeRequestManager requestManager;
private SessionManager sessionManager;
private ModelProviderFactory modelProviderFactory;
@@ -59,7 +55,7 @@
@Before
public void setUp() {
initMocks(this);
- InfraIntegrationScope scope = new InfraIntegrationScope.Builder(threadUtils).build();
+ InfraIntegrationScope scope = new InfraIntegrationScope.Builder().build();
requestManager = scope.getRequestManager();
sessionManager = scope.getSessionManager();
modelProviderFactory = scope.getModelProviderFactory();
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/StructureUpdateTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/StructureUpdateTest.java
index 8a4c56c..6518c1c 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/StructureUpdateTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/StructureUpdateTest.java
@@ -20,7 +20,6 @@
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.android.libraries.feed.api.common.MutationContext;
-import com.google.android.libraries.feed.api.common.ThreadUtils;
import com.google.android.libraries.feed.api.modelprovider.FeatureChange;
import com.google.android.libraries.feed.api.modelprovider.FeatureChangeObserver;
import com.google.android.libraries.feed.api.modelprovider.ModelChild;
@@ -43,14 +42,11 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
/** Tests which update (append) content to an existing model. */
@RunWith(RobolectricTestRunner.class)
public class StructureUpdateTest {
- @Mock private ThreadUtils threadUtils;
-
private FakeRequestManager requestManager;
private SessionManager sessionManager;
private ProtocolAdapter protocolAdapter;
@@ -60,7 +56,7 @@
@Before
public void setUp() {
initMocks(this);
- InfraIntegrationScope scope = new InfraIntegrationScope.Builder(threadUtils).build();
+ InfraIntegrationScope scope = new InfraIntegrationScope.Builder().build();
requestManager = scope.getRequestManager();
sessionManager = scope.getSessionManager();
modelProviderFactory = scope.getModelProviderFactory();
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/SyntheticTokensTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/SyntheticTokensTest.java
index f91ef6f..3c3d0fb 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/SyntheticTokensTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/SyntheticTokensTest.java
@@ -35,7 +35,6 @@
import com.google.android.libraries.feed.api.sessionmanager.SessionManager;
import com.google.android.libraries.feed.common.Result;
import com.google.android.libraries.feed.common.concurrent.TaskQueue;
-import com.google.android.libraries.feed.common.concurrent.testing.FakeThreadUtils;
import com.google.android.libraries.feed.common.functional.Consumer;
import com.google.android.libraries.feed.common.testing.InfraIntegrationScope;
import com.google.android.libraries.feed.common.testing.ModelProviderValidator;
@@ -81,9 +80,7 @@
.put(ConfigKey.NON_CACHED_MIN_PAGE_SIZE, MIN_PAGE_SIZE)
.build();
InfraIntegrationScope scope =
- new InfraIntegrationScope.Builder(new FakeThreadUtils(/* enforceThreadChecks= */ false))
- .setConfiguration(configuration)
- .build();
+ new InfraIntegrationScope.Builder().setConfiguration(configuration).build();
fakeClock = scope.getFakeClock();
requestManager = scope.getRequestManager();
sessionManager = scope.getSessionManager();
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/TimeoutSessionBaseTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/TimeoutSessionBaseTest.java
index 2d5ddf5..22e6073 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/TimeoutSessionBaseTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/TimeoutSessionBaseTest.java
@@ -53,9 +53,8 @@
// This flag will should be flipped to debug the test. It will disable TimeoutExceptions.
private static final boolean DEBUG = false;
- private final FakeThreadUtils fakeThreadUtils =
- new FakeThreadUtils(/* enforceThreadChecks= */ false);
- private final FakeSchedulerApi fakeSchedulerApi = new FakeSchedulerApi(fakeThreadUtils);
+ private final FakeSchedulerApi fakeSchedulerApi =
+ new FakeSchedulerApi(FakeThreadUtils.withoutThreadChecks());
private FakeClock fakeClock;
private FakeRequestManager requestManager;
@@ -69,7 +68,7 @@
initMocks(this);
Configuration configuration = InfraIntegrationScope.getTimeoutSchedulerConfig();
InfraIntegrationScope scope =
- new InfraIntegrationScope.Builder(fakeThreadUtils)
+ new InfraIntegrationScope.Builder()
.setConfiguration(configuration)
.setSchedulerApi(fakeSchedulerApi)
.build();
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/TimeoutSessionWithContentTest.java b/src/test/java/com/google/android/libraries/feed/infraintegration/TimeoutSessionWithContentTest.java
index 8e2ec0a..2a23feb 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/TimeoutSessionWithContentTest.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/TimeoutSessionWithContentTest.java
@@ -67,9 +67,8 @@
ResponseBuilder.createFeatureContentId(5)
};
- private final FakeThreadUtils fakeThreadUtils =
- new FakeThreadUtils(/* enforceThreadChecks= */ false);
- private final FakeSchedulerApi fakeSchedulerApi = new FakeSchedulerApi(fakeThreadUtils);
+ private final FakeSchedulerApi fakeSchedulerApi =
+ new FakeSchedulerApi(FakeThreadUtils.withoutThreadChecks());
private FakeClock fakeClock;
private FakeRequestManager requestManager;
@@ -83,7 +82,7 @@
initMocks(this);
Configuration configuration = InfraIntegrationScope.getTimeoutSchedulerConfig();
InfraIntegrationScope scope =
- new InfraIntegrationScope.Builder(fakeThreadUtils)
+ new InfraIntegrationScope.Builder()
.setConfiguration(configuration)
.setSchedulerApi(fakeSchedulerApi)
.build();
diff --git a/src/test/java/com/google/android/libraries/feed/infraintegration/ViewDepthProviderTests.java b/src/test/java/com/google/android/libraries/feed/infraintegration/ViewDepthProviderTests.java
index 4bd5db1..43f9bdc 100644
--- a/src/test/java/com/google/android/libraries/feed/infraintegration/ViewDepthProviderTests.java
+++ b/src/test/java/com/google/android/libraries/feed/infraintegration/ViewDepthProviderTests.java
@@ -19,7 +19,6 @@
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.android.libraries.feed.api.common.MutationContext;
-import com.google.android.libraries.feed.api.common.ThreadUtils;
import com.google.android.libraries.feed.api.modelprovider.ModelProvider;
import com.google.android.libraries.feed.api.modelprovider.ModelProvider.ViewDepthProvider;
import com.google.android.libraries.feed.api.modelprovider.ModelProviderFactory;
@@ -77,7 +76,6 @@
ResponseBuilder.createFeatureContentId(7)
};
- @Mock private ThreadUtils threadUtils;
@Mock private SchedulerApi schedulerApi;
private FakeRequestManager requestManager;
@@ -92,7 +90,7 @@
initMocks(this);
Configuration configuration = InfraIntegrationScope.getTimeoutSchedulerConfig();
InfraIntegrationScope scope =
- new InfraIntegrationScope.Builder(threadUtils)
+ new InfraIntegrationScope.Builder()
.setConfiguration(configuration)
.setSchedulerApi(schedulerApi)
.build();
diff --git a/src/test/java/com/google/android/libraries/feed/mocknetworkclient/MockServerNetworkClientTest.java b/src/test/java/com/google/android/libraries/feed/mocknetworkclient/MockServerNetworkClientTest.java
index c87e40d..1615ef0 100644
--- a/src/test/java/com/google/android/libraries/feed/mocknetworkclient/MockServerNetworkClientTest.java
+++ b/src/test/java/com/google/android/libraries/feed/mocknetworkclient/MockServerNetworkClientTest.java
@@ -71,7 +71,7 @@
public class MockServerNetworkClientTest extends NetworkClientConformanceTest {
private final Configuration configuration = new Configuration.Builder().build();
private final FakeClock fakeClock = new FakeClock();
- private final FakeThreadUtils fakeThreadUtils = new FakeThreadUtils();
+ private final FakeThreadUtils fakeThreadUtils = FakeThreadUtils.withThreadChecks();
private final FeedExtensionRegistry extensionRegistry = new FeedExtensionRegistry(ArrayList::new);
private final TimingUtils timingUtils = new TimingUtils();