diff --git a/firebase-firestore/src/androidTest/java/com/google/firebase/firestore/FirestoreTest.java b/firebase-firestore/src/androidTest/java/com/google/firebase/firestore/FirestoreTest.java index a38ee616b4d..7a8038e42dc 100644 --- a/firebase-firestore/src/androidTest/java/com/google/firebase/firestore/FirestoreTest.java +++ b/firebase-firestore/src/androidTest/java/com/google/firebase/firestore/FirestoreTest.java @@ -98,7 +98,7 @@ public void testCanUpdateAnUnknownDocument() { fail("Should have thrown exception"); } catch (RuntimeException e) { assertEquals( - ((FirebaseFirestoreException) e.getCause().getCause()).getCode(), Code.UNAVAILABLE); + Code.UNAVAILABLE, ((FirebaseFirestoreException) e.getCause().getCause()).getCode()); } writerSnap = waitFor(writerRef.get()); assertEquals(map("a", "a", "b", "b"), writerSnap.getData()); @@ -1060,7 +1060,7 @@ public void testMaintainsPersistenceAfterRestarting() { testFirestore(provider().projectId(), Level.DEBUG, newTestSettings(), "dbPersistenceKey"); DocumentReference docRef2 = firestore2.document(docRef.getPath()); DocumentSnapshot doc = waitFor(docRef2.get()); - assertEquals(doc.exists(), true); + assertTrue(doc.exists()); } @Test @@ -1112,7 +1112,7 @@ public void testRestartFirestoreLeadsToNewInstance() { // Verify new instance works. DocumentSnapshot doc = waitFor(newInstance.document("abc/123").get()); - assertEquals(doc.get("field"), 100L); + assertEquals(100L, doc.get("field")); waitFor(newInstance.document("abc/123").delete()); // Verify it is different instance. @@ -1233,7 +1233,6 @@ public void testWaitForPendingWritesFailsWhenUserChanges() { public void testPendingWriteTaskResolveWhenOfflineIfThereIsNoPending() { DocumentReference documentReference = testCollection("abc").document("123"); FirebaseFirestore firestore = documentReference.getFirestore(); - Map data = map("foo", "bar"); // Prevent pending writes receiving acknowledgement. waitFor(firestore.disableNetwork()); diff --git a/firebase-firestore/src/androidTest/java/com/google/firebase/firestore/ValidationTest.java b/firebase-firestore/src/androidTest/java/com/google/firebase/firestore/ValidationTest.java index 02f816baa65..33cc435db2f 100644 --- a/firebase-firestore/src/androidTest/java/com/google/firebase/firestore/ValidationTest.java +++ b/firebase-firestore/src/androidTest/java/com/google/firebase/firestore/ValidationTest.java @@ -779,16 +779,6 @@ private static void expectWriteSuccess(Object data) { expectWriteSuccess(data, /*includeSets=*/ true, /*includeUpdates=*/ true); } - /** Performs a write using each update API and makes sure it succeeds. */ - private static void expectUpdateSuccess(Map data) { - expectWriteSuccess(data, /*includeSets=*/ false, /*includeUpdates=*/ true); - } - - /** Performs a write using each set API and makes sure it succeeds. */ - private static void expectSetSuccess(Object data) { - expectWriteSuccess(data, /*includeSets=*/ true, /*includeUpdates=*/ false); - } - /** * Performs a write using each set and/or update API and makes sure it fails with the expected * reason. diff --git a/firebase-firestore/src/test/java/com/google/firebase/firestore/local/IndexedQueryEngineTest.java b/firebase-firestore/src/test/java/com/google/firebase/firestore/local/IndexedQueryEngineTest.java index 6e7c339cdaf..02895b472cb 100644 --- a/firebase-firestore/src/test/java/com/google/firebase/firestore/local/IndexedQueryEngineTest.java +++ b/firebase-firestore/src/test/java/com/google/firebase/firestore/local/IndexedQueryEngineTest.java @@ -65,7 +65,6 @@ public void setUp() { SQLitePersistence persistence = PersistenceTestHelpers.createSQLitePersistence(); SQLiteCollectionIndex index = new SQLiteCollectionIndex(persistence, User.UNAUTHENTICATED); - MutationQueue mutationQueue = persistence.getMutationQueue(User.UNAUTHENTICATED); remoteDocuments = persistence.getRemoteDocumentCache(); queryEngine = new IndexedQueryEngine(index); } diff --git a/firebase-firestore/src/test/java/com/google/firebase/firestore/local/SQLiteSchemaTest.java b/firebase-firestore/src/test/java/com/google/firebase/firestore/local/SQLiteSchemaTest.java index 811615ed5c9..ea27ed002df 100644 --- a/firebase-firestore/src/test/java/com/google/firebase/firestore/local/SQLiteSchemaTest.java +++ b/firebase-firestore/src/test/java/com/google/firebase/firestore/local/SQLiteSchemaTest.java @@ -562,7 +562,7 @@ public void rewritesCanonicalIds() { Target targetProto = Target.parseFrom(targetProtoBytes); TargetData targetData = serializer.decodeTargetData(targetProto); String expectedCanonicalId = targetData.getTarget().getCanonicalId(); - assertEquals(actualCanonicalId, expectedCanonicalId); + assertEquals(expectedCanonicalId, actualCanonicalId); } catch (InvalidProtocolBufferException e) { fail("Failed to decode Target data"); } diff --git a/firebase-firestore/src/test/java/com/google/firebase/firestore/model/ValuesTest.java b/firebase-firestore/src/test/java/com/google/firebase/firestore/model/ValuesTest.java index d9390f099fd..2bdbcd2ac9b 100644 --- a/firebase-firestore/src/test/java/com/google/firebase/firestore/model/ValuesTest.java +++ b/firebase-firestore/src/test/java/com/google/firebase/firestore/model/ValuesTest.java @@ -33,7 +33,12 @@ import java.util.Date; import java.util.TimeZone; import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.annotation.Config; +@RunWith(RobolectricTestRunner.class) +@Config(manifest = Config.NONE) public class ValuesTest { private final Date date1; private final Date date2; diff --git a/firebase-firestore/src/testUtil/java/com/google/firebase/firestore/testutil/ComparatorTester.java b/firebase-firestore/src/testUtil/java/com/google/firebase/firestore/testutil/ComparatorTester.java index 3d26d1b2619..dd4b7579159 100644 --- a/firebase-firestore/src/testUtil/java/com/google/firebase/firestore/testutil/ComparatorTester.java +++ b/firebase-firestore/src/testUtil/java/com/google/firebase/firestore/testutil/ComparatorTester.java @@ -70,7 +70,7 @@ * @author bmaurer@google.com (Ben Maurer) */ public class ComparatorTester { - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings({"rawtypes"}) private final @Nullable Comparator comparator; /** The items that we are checking, stored as a sorted set of equivalence classes. */ @@ -192,7 +192,6 @@ private void testNullCompare(Object obj) { } } - @SuppressWarnings("unchecked") private void testClassCast(Object obj) { if (comparator == null) { try { diff --git a/firebase-firestore/src/testUtil/java/com/google/firebase/firestore/testutil/TestUtil.java b/firebase-firestore/src/testUtil/java/com/google/firebase/firestore/testutil/TestUtil.java index ffcbc930eac..da03ca03c03 100644 --- a/firebase-firestore/src/testUtil/java/com/google/firebase/firestore/testutil/TestUtil.java +++ b/firebase-firestore/src/testUtil/java/com/google/firebase/firestore/testutil/TestUtil.java @@ -20,7 +20,6 @@ import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.fail; -import androidx.annotation.NonNull; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.android.gms.common.internal.Preconditions; @@ -556,15 +555,6 @@ public static ByteString resumeToken(long snapshotVersion) { return ByteString.copyFrom(snapshotString, Charsets.UTF_8); } - @NonNull - private static ByteString resumeToken(SnapshotVersion snapshotVersion) { - if (snapshotVersion.equals(SnapshotVersion.NONE)) { - return ByteString.EMPTY; - } else { - return ByteString.copyFromUtf8(snapshotVersion.toString()); - } - } - public static ByteString streamToken(String contents) { return ByteString.copyFrom(contents, Charsets.UTF_8); }