Remove deprecated containsAllOf+containsAllIn and isOrdered+isStrictlyOrdered.
(Also, internally remove isSameAs+isNotSameAs, which had already been removed externally.)
Relnotes:
Removed deprecated `containsAllOf` and `containsAllIn`. Use `containsAtLeast` and `containsAtLeastElementsIn`, which are equivalent.
Removed deprecated `isOrdered` and `isStrictlyOrdered`. Use `isInOrder` and `isInStrictOrder`, which are equivalent.
[]
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=252840812
diff --git a/core/src/main/java/com/google/common/truth/IterableSubject.java b/core/src/main/java/com/google/common/truth/IterableSubject.java
index 403c7cd..6a94ed4 100644
--- a/core/src/main/java/com/google/common/truth/IterableSubject.java
+++ b/core/src/main/java/com/google/common/truth/IterableSubject.java
@@ -227,60 +227,6 @@
* <p>To also test that the contents appear in the given order, make a call to {@code inOrder()}
* on the object returned by this method. The expected elements must appear in the given order
* within the actual elements, but they are not required to be consecutive.
- *
- * @deprecated Use {@link #containsAtLeast}, which is equivalent.
- */
- @CanIgnoreReturnValue
- @Deprecated
- public final Ordered containsAllOf(
- @NullableDecl Object firstExpected,
- @NullableDecl Object secondExpected,
- @NullableDecl Object... restOfExpected) {
- return containsAtLeast(firstExpected, secondExpected, restOfExpected);
- }
-
- /**
- * Checks that the actual iterable contains at least all of the expected elements or fails. If an
- * element appears more than once in the expected elements then it must appear at least that
- * number of times in the actual elements.
- *
- * <p>To also test that the contents appear in the given order, make a call to {@code inOrder()}
- * on the object returned by this method. The expected elements must appear in the given order
- * within the actual elements, but they are not required to be consecutive.
- *
- * @deprecated Use {@link #containsAtLeastElementsIn(Iterable)}, which is equivalent.
- */
- @CanIgnoreReturnValue
- @Deprecated
- public final Ordered containsAllIn(Iterable<?> expectedIterable) {
- return containsAtLeastElementsIn(expectedIterable);
- }
-
- /**
- * Checks that the actual iterable contains at least all of the expected elements or fails. If an
- * element appears more than once in the expected elements then it must appear at least that
- * number of times in the actual elements.
- *
- * <p>To also test that the contents appear in the given order, make a call to {@code inOrder()}
- * on the object returned by this method. The expected elements must appear in the given order
- * within the actual elements, but they are not required to be consecutive.
- *
- * @deprecated Use {@link #containsAtLeastElementsIn(Object[])}, which is equivalent.
- */
- @CanIgnoreReturnValue
- @Deprecated
- public final Ordered containsAllIn(Object[] expected) {
- return containsAtLeastElementsIn(expected);
- }
-
- /**
- * Checks that the actual iterable contains at least all of the expected elements or fails. If an
- * element appears more than once in the expected elements to this call then it must appear at
- * least that number of times in the actual elements.
- *
- * <p>To also test that the contents appear in the given order, make a call to {@code inOrder()}
- * on the object returned by this method. The expected elements must appear in the given order
- * within the actual elements, but they are not required to be consecutive.
*/
@CanIgnoreReturnValue
public final Ordered containsAtLeast(
@@ -847,61 +793,6 @@
});
}
- /**
- * Fails if the iterable is not strictly ordered, according to the natural ordering of its
- * elements. Strictly ordered means that each element in the iterable is <i>strictly</i> greater
- * than the element that preceded it.
- *
- * @throws ClassCastException if any pair of elements is not mutually Comparable
- * @throws NullPointerException if any element is null
- * @deprecated Use {@link #isInStrictOrder()}.
- */
- @Deprecated
- public final void isStrictlyOrdered() {
- isInStrictOrder();
- }
-
- /**
- * Fails if the iterable is not strictly ordered, according to the given comparator. Strictly
- * ordered means that each element in the iterable is <i>strictly</i> greater than the element
- * that preceded it.
- *
- * @throws ClassCastException if any pair of elements is not mutually Comparable
- * @deprecated Use {@link #isInStrictOrder(Comparator)}.
- */
- @Deprecated
- @SuppressWarnings({"unchecked"})
- public final void isStrictlyOrdered(final Comparator<?> comparator) {
- isInStrictOrder(comparator);
- }
-
- /**
- * Fails if the iterable is not ordered, according to the natural ordering of its elements.
- * Ordered means that each element in the iterable is greater than or equal to the element that
- * preceded it.
- *
- * @throws ClassCastException if any pair of elements is not mutually Comparable
- * @throws NullPointerException if any element is null
- * @deprecated Use {@link #isInOrder()}
- */
- @Deprecated
- public final void isOrdered() {
- isInOrder();
- }
-
- /**
- * Fails if the iterable is not ordered, according to the given comparator. Ordered means that
- * each element in the iterable is greater than or equal to the element that preceded it.
- *
- * @throws ClassCastException if any pair of elements is not mutually Comparable
- * @deprecated Use {@link #isInOrder(Comparator)}.
- */
- @Deprecated
- @SuppressWarnings({"unchecked"})
- public final void isOrdered(final Comparator<?> comparator) {
- isInOrder(comparator);
- }
-
private interface PairwiseChecker {
boolean check(Object prev, Object next);
}
@@ -1567,59 +1458,6 @@
* <p>To also test that the contents appear in the given order, make a call to {@code inOrder()}
* on the object returned by this method. The elements must appear in the given order within the
* subject, but they are not required to be consecutive.
- *
- * @deprecated Use {@link #containsAtLeast}, which is equivalent.
- */
- @SafeVarargs
- @CanIgnoreReturnValue
- @Deprecated
- public final Ordered containsAllOf(
- @NullableDecl E first, @NullableDecl E second, @NullableDecl E... rest) {
- return containsAtLeast(first, second, rest);
- }
-
- /**
- * Checks that the subject contains elements that corresponds to all of the expected elements,
- * i.e. that there is a 1:1 mapping between any subset of the actual elements and the expected
- * elements where each pair of elements correspond.
- *
- * <p>To also test that the contents appear in the given order, make a call to {@code inOrder()}
- * on the object returned by this method. The elements must appear in the given order within the
- * subject, but they are not required to be consecutive.
- *
- * @deprecated Use {@link #containsAtLeastElementsIn(Iterable)}, which is equivalent.
- */
- @CanIgnoreReturnValue
- @Deprecated
- public Ordered containsAllIn(final Iterable<? extends E> expected) {
- return containsAtLeastElementsIn(expected);
- }
-
- /**
- * Checks that the subject contains elements that corresponds to all of the expected elements,
- * i.e. that there is a 1:1 mapping between any subset of the actual elements and the expected
- * elements where each pair of elements correspond.
- *
- * <p>To also test that the contents appear in the given order, make a call to {@code inOrder()}
- * on the object returned by this method. The elements must appear in the given order within the
- * subject, but they are not required to be consecutive.
- *
- * @deprecated Use {@link #containsAtLeastElementsIn(Object[])}, which is equivalent.
- */
- @CanIgnoreReturnValue
- @Deprecated
- public Ordered containsAllIn(E[] expected) {
- return containsAtLeastElementsIn(expected);
- }
-
- /**
- * Checks that the subject contains elements that corresponds to all of the expected elements,
- * i.e. that there is a 1:1 mapping between any subset of the actual elements and the expected
- * elements where each pair of elements correspond.
- *
- * <p>To also test that the contents appear in the given order, make a call to {@code inOrder()}
- * on the object returned by this method. The elements must appear in the given order within the
- * subject, but they are not required to be consecutive.
*/
@SafeVarargs
@CanIgnoreReturnValue
diff --git a/core/src/main/java/com/google/common/truth/MultimapSubject.java b/core/src/main/java/com/google/common/truth/MultimapSubject.java
index 5870605..ef6160f 100644
--- a/core/src/main/java/com/google/common/truth/MultimapSubject.java
+++ b/core/src/main/java/com/google/common/truth/MultimapSubject.java
@@ -748,7 +748,7 @@
.about(iterableEntries())
.that(actual.entries())
.comparingElementsUsing(new EntryCorrespondence<K, A, V>(correspondence))
- .containsAllIn(expectedMultimap.entries());
+ .containsAtLeastElementsIn(expectedMultimap.entries());
}
/**
diff --git a/core/src/main/java/com/google/common/truth/PrimitiveDoubleArraySubject.java b/core/src/main/java/com/google/common/truth/PrimitiveDoubleArraySubject.java
index 5ff3214..4b4e862 100644
--- a/core/src/main/java/com/google/common/truth/PrimitiveDoubleArraySubject.java
+++ b/core/src/main/java/com/google/common/truth/PrimitiveDoubleArraySubject.java
@@ -263,17 +263,6 @@
return containsAtLeastElementsIn(Doubles.asList(expected));
}
- /**
- * As {@link #containsAllOf(Object, Object, Object...)} but taking a primitive double array.
- *
- * @deprecated Use {@link #containsAtLeast(double[])}, which is equivalent.
- */
- @CanIgnoreReturnValue
- @Deprecated
- public Ordered containsAllOf(double[] expected) {
- return containsAtLeast(expected);
- }
-
/** As {@link #containsAnyOf(Object, Object, Object...)} but taking a primitive double array. */
public void containsAnyOf(double[] expected) {
containsAnyIn(Doubles.asList(expected));
diff --git a/core/src/main/java/com/google/common/truth/PrimitiveFloatArraySubject.java b/core/src/main/java/com/google/common/truth/PrimitiveFloatArraySubject.java
index 0be0b95..d4bfd5f 100644
--- a/core/src/main/java/com/google/common/truth/PrimitiveFloatArraySubject.java
+++ b/core/src/main/java/com/google/common/truth/PrimitiveFloatArraySubject.java
@@ -270,17 +270,6 @@
return containsAtLeastElementsIn(Floats.asList(expected));
}
- /**
- * As {@link #containsAllOf(Object, Object, Object...)} but taking a primitive float array.
- *
- * @deprecated Use {@link #containsAtLeast(float[])}, which is equivalent.
- */
- @CanIgnoreReturnValue
- @Deprecated
- public Ordered containsAllOf(float[] expected) {
- return containsAtLeast(expected);
- }
-
/** As {@link #containsAnyOf(Object, Object, Object...)} but taking a primitive float array. */
public void containsAnyOf(float[] expected) {
containsAnyIn(Floats.asList(expected));
diff --git a/core/src/main/java/com/google/common/truth/Subject.java b/core/src/main/java/com/google/common/truth/Subject.java
index 54fc2f4..c7b14c7 100644
--- a/core/src/main/java/com/google/common/truth/Subject.java
+++ b/core/src/main/java/com/google/common/truth/Subject.java
@@ -259,8 +259,8 @@
/*
* Pass through *whether* the values are equal so that failEqualityCheck() can print that
* information. But remove the description of the difference, which is always about
- * content, since people calling isSameAs() are explicitly not interested in content, only
- * object identity.
+ * content, since people calling isSameInstanceAs() are explicitly not interested in
+ * content, only object identity.
*/
compareForEquality(expected).withoutDescription());
}
@@ -820,7 +820,8 @@
boolean sameToStrings = actualString.equals(expectedString);
boolean sameClassNames = actualClass.equals(expectedClass);
// TODO(cpovirk): Handle "same class name, different class loader."
- boolean equal = difference.valuesAreEqual(); // always false for isEqualTo; varies for isSameAs
+ // `equal` is always false for isEqualTo, but it varies for isSameInstanceAs:
+ boolean equal = difference.valuesAreEqual();
// TODO(cpovirk): Call attention to differing trailing whitespace.
if (sameToStrings) {
diff --git a/core/src/main/java/com/google/common/truth/ThrowableSubject.java b/core/src/main/java/com/google/common/truth/ThrowableSubject.java
index f0d1348..e1a88fa 100644
--- a/core/src/main/java/com/google/common/truth/ThrowableSubject.java
+++ b/core/src/main/java/com/google/common/truth/ThrowableSubject.java
@@ -42,8 +42,8 @@
}
/*
- * TODO(cpovirk): consider a special case for isEqualTo and isSameAs that adds |expected| as a
- * suppressed exception
+ * TODO(cpovirk): consider a special case for isEqualTo and isSameInstanceAs that adds |expected|
+ * as a suppressed exception
*/
/** Returns a {@code StringSubject} to make assertions about the throwable's message. */
diff --git a/core/src/main/java/com/google/common/truth/Truth.java b/core/src/main/java/com/google/common/truth/Truth.java
index a2987a4..d922be0 100644
--- a/core/src/main/java/com/google/common/truth/Truth.java
+++ b/core/src/main/java/com/google/common/truth/Truth.java
@@ -46,7 +46,7 @@
* assertThat(a).isEqualTo(b);
* assertThat(c).isTrue();
* assertThat(d).contains(a);
- * assertThat(d).containsAllOf(a, b);
+ * assertThat(d).containsAtLeast(a, b);
* assertThat(d).containsAnyOf(a, b, c);
* }</pre>
*
diff --git a/core/src/test/java/com/google/common/truth/IterableSubjectCorrespondenceTest.java b/core/src/test/java/com/google/common/truth/IterableSubjectCorrespondenceTest.java
index 59f8800..e42c011 100644
--- a/core/src/test/java/com/google/common/truth/IterableSubjectCorrespondenceTest.java
+++ b/core/src/test/java/com/google/common/truth/IterableSubjectCorrespondenceTest.java
@@ -1058,44 +1058,44 @@
}
@Test
- public void containsAllIn_inOrder_success() {
+ public void containsAtLeastElementsIn_inOrder_success() {
ImmutableList<Integer> expected = ImmutableList.of(64, 128, 256, 128);
ImmutableList<String> actual =
ImmutableList.of("fee", "+64", "+128", "fi", "fo", "+256", "0x80", "fum");
assertThat(actual)
.comparingElementsUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE)
- .containsAllIn(expected)
+ .containsAtLeastElementsIn(expected)
.inOrder();
}
@Test
- public void containsAllIn_successOutOfOrder() {
+ public void containsAtLeastElementsIn_successOutOfOrder() {
ImmutableList<Integer> expected = ImmutableList.of(64, 128, 256, 128);
ImmutableList<String> actual =
ImmutableList.of("fee", "+128", "+64", "fi", "fo", "0x80", "+256", "fum");
assertThat(actual)
.comparingElementsUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE)
- .containsAllIn(expected);
+ .containsAtLeastElementsIn(expected);
}
@Test
- public void containsAllIn_outOfOrderDoesNotStringify() {
+ public void containsAtLeastElementsIn_outOfOrderDoesNotStringify() {
CountsToStringCalls o = new CountsToStringCalls();
List<Object> actual = asList(o, 1);
List<Object> expected = asList(1, o);
- assertThat(actual).comparingElementsUsing(EQUALITY).containsAllIn(expected);
+ assertThat(actual).comparingElementsUsing(EQUALITY).containsAtLeastElementsIn(expected);
assertThat(o.calls).isEqualTo(0);
expectFailure
.whenTesting()
.that(actual)
.comparingElementsUsing(EQUALITY)
- .containsAllIn(expected)
+ .containsAtLeastElementsIn(expected)
.inOrder();
assertThat(o.calls).isGreaterThan(0);
}
@Test
- public void containsAllIn_successNonGreedy() {
+ public void containsAtLeastElementsIn_successNonGreedy() {
// (We use doubles with approximate equality for this test, because we can't illustrate this
// case with the string parsing correspondence used in the other tests, because one string
// won't parse to more than one integer.)
@@ -1106,12 +1106,14 @@
// it would pair 1.0 with 1.05 and 1.1 with 1.15, and fail to pair 1.2 with 0.95. Check that the
// implementation is truly non-greedy by testing all permutations.
for (List<Double> permutedActual : permutations(actual)) {
- assertThat(permutedActual).comparingElementsUsing(tolerance(0.1)).containsAllIn(expected);
+ assertThat(permutedActual)
+ .comparingElementsUsing(tolerance(0.1))
+ .containsAtLeastElementsIn(expected);
}
}
@Test
- public void containsAllIn_failsMissingOneCandidate() {
+ public void containsAtLeastElementsIn_failsMissingOneCandidate() {
ImmutableList<Integer> expected = ImmutableList.of(64, 128, 256, 128);
ImmutableList<String> actual =
ImmutableList.of("fee", "+64", "+128", "fi", "fo", "0x40", "0x80", "fum");
@@ -1120,7 +1122,7 @@
.whenTesting()
.that(actual)
.comparingElementsUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE)
- .containsAllIn(expected);
+ .containsAtLeastElementsIn(expected);
assertThat(expectFailure.getFailure())
.hasMessageThat()
.isEqualTo(
@@ -1130,7 +1132,7 @@
}
@Test
- public void containsAllIn_handlesExceptions() {
+ public void containsAtLeastElementsIn_handlesExceptions() {
ImmutableList<String> expected = ImmutableList.of("ABC", "DEF", "GHI");
// CASE_INSENSITIVE_EQUALITY.compare throws on the null actual element.
List<String> actual = asList(null, "xyz", "abc", "ghi");
@@ -1138,7 +1140,7 @@
.whenTesting()
.that(actual)
.comparingElementsUsing(CASE_INSENSITIVE_EQUALITY)
- .containsAllIn(expected);
+ .containsAtLeastElementsIn(expected);
// We fail with the more helpful failure message about the mis-matched values, not the NPE.
assertFailureKeys(
"Not true that <[null, xyz, abc, ghi]> contains at least one element that "
@@ -1152,14 +1154,14 @@
}
@Test
- public void containsAllIn_handlesExceptions_alwaysFails() {
+ public void containsAtLeastElementsIn_handlesExceptions_alwaysFails() {
List<String> expected = asList("ABC", "DEF", null);
List<String> actual = asList(null, "def", "ghi", "abc");
expectFailure
.whenTesting()
.that(actual)
.comparingElementsUsing(CASE_INSENSITIVE_EQUALITY_HALF_NULL_SAFE)
- .containsAllIn(expected);
+ .containsAtLeastElementsIn(expected);
// CASE_INSENSITIVE_EQUALITY_HALF_NULL_SAFE.compare(null, null) returns true, so there is a
// mapping between actual and expected elements which includes all the expected. However, no
// reasonable implementation would find that mapping without hitting the (null, "ABC") case
@@ -1177,7 +1179,7 @@
}
@Test
- public void displayingElementsPairedBy_containsAllIn() {
+ public void displayingElementsPairedBy_containsAtLeastElementsIn() {
ImmutableList<Record> expected =
ImmutableList.of(Record.create(1, 100), Record.create(2, 200), Record.createWithoutId(999));
ImmutableList<Record> actual =
@@ -1192,7 +1194,7 @@
.that(actual)
.comparingElementsUsing(RECORDS_EQUAL_WITH_SCORE_TOLERANCE_10)
.displayingDiffsPairedBy(RECORD_ID)
- .containsAllIn(expected);
+ .containsAtLeastElementsIn(expected);
assertThat(expectFailure.getFailure())
.hasMessageThat()
.isEqualTo(
@@ -1205,7 +1207,7 @@
}
@Test
- public void displayingElementsPairedBy_containsAllIn_notUnique() {
+ public void displayingElementsPairedBy_containsAtLeastElementsIn_notUnique() {
ImmutableList<Record> expected =
ImmutableList.of(
Record.create(1, 100),
@@ -1219,7 +1221,7 @@
.that(actual)
.comparingElementsUsing(RECORDS_EQUAL_WITH_SCORE_TOLERANCE_10)
.displayingDiffsPairedBy(RECORD_ID)
- .containsAllIn(expected);
+ .containsAtLeastElementsIn(expected);
assertThat(expectFailure.getFailure())
.hasMessageThat()
.isEqualTo(
@@ -1232,7 +1234,7 @@
}
@Test
- public void displayingElementsPairedBy_containsAllIn_handlesFormatDiffExceptions() {
+ public void displayingElementsPairedBy_containsAtLeastElementsIn_handlesFormatDiffExceptions() {
ImmutableList<Record> expected =
ImmutableList.of(Record.create(1, 100), Record.create(2, 200), Record.create(0, 999));
List<Record> actual =
@@ -1242,7 +1244,7 @@
.that(actual)
.comparingElementsUsing(RECORDS_EQUAL_WITH_SCORE_TOLERANCE_10)
.displayingDiffsPairedBy(NULL_SAFE_RECORD_ID)
- .containsAllIn(expected);
+ .containsAtLeastElementsIn(expected);
assertFailureKeys(
"Not true that <[1/101, 2/211, 3/303, null]> contains at least one element that has the "
+ "same id as and a score is within 10 of each element of <[1/100, 2/200, 0/999]>. "
@@ -1257,7 +1259,7 @@
}
@Test
- public void containsAllIn_failsMultipleMissingCandidates() {
+ public void containsAtLeastElementsIn_failsMultipleMissingCandidates() {
ImmutableList<Integer> expected = ImmutableList.of(64, 128, 256, 128);
ImmutableList<String> actual =
ImmutableList.of("fee", "+64", "+64", "fi", "fo", "0x40", "0x40", "fum");
@@ -1266,7 +1268,7 @@
.whenTesting()
.that(actual)
.comparingElementsUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE)
- .containsAllIn(expected);
+ .containsAtLeastElementsIn(expected);
assertThat(expectFailure.getFailure())
.hasMessageThat()
.isEqualTo(
@@ -1276,7 +1278,7 @@
}
@Test
- public void containsAllIn_failsOrderedMissingOneCandidate() {
+ public void containsAtLeastElementsIn_failsOrderedMissingOneCandidate() {
ImmutableList<Integer> expected = ImmutableList.of(64, 128, 256, 512);
ImmutableList<String> actual =
ImmutableList.of("fee", "+64", "fi", "fo", "+128", "+256", "fum");
@@ -1285,7 +1287,7 @@
.whenTesting()
.that(actual)
.comparingElementsUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE)
- .containsAllIn(expected);
+ .containsAtLeastElementsIn(expected);
assertThat(expectFailure.getFailure())
.hasMessageThat()
.isEqualTo(
@@ -1295,7 +1297,7 @@
}
@Test
- public void containsAllIn_failsMissingElementInOneToOne() {
+ public void containsAtLeastElementsIn_failsMissingElementInOneToOne() {
ImmutableList<Integer> expected = ImmutableList.of(64, 128, 256, 128);
ImmutableList<String> actual =
ImmutableList.of("fee", "+128", "fi", "fo", "+64", "+256", "fum");
@@ -1303,7 +1305,7 @@
.whenTesting()
.that(actual)
.comparingElementsUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE)
- .containsAllIn(expected);
+ .containsAtLeastElementsIn(expected);
assertThat(expectFailure.getFailure())
.hasMessageThat()
.isEqualTo(
@@ -1316,7 +1318,7 @@
}
@Test
- public void containsAllIn_inOrder_failsOutOfOrder() {
+ public void containsAtLeastElementsIn_inOrder_failsOutOfOrder() {
ImmutableList<Integer> expected = ImmutableList.of(64, 128, 256, 128);
ImmutableList<String> actual =
ImmutableList.of("fee", "+128", "+64", "fi", "fo", "0x80", "+256", "fum");
@@ -1324,7 +1326,7 @@
.whenTesting()
.that(actual)
.comparingElementsUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE)
- .containsAllIn(expected)
+ .containsAtLeastElementsIn(expected)
.inOrder();
assertFailureKeys(
"required elements were all found, but order was wrong",
@@ -1335,12 +1337,12 @@
}
@Test
- public void containsAllIn_null() {
+ public void containsAtLeastElementsIn_null() {
List<Integer> expected = Arrays.asList(128, null);
List<String> actual = Arrays.asList(null, "fee", "0x80");
assertThat(actual)
.comparingElementsUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE)
- .containsAllIn(expected);
+ .containsAtLeastElementsIn(expected);
}
@Test
@@ -1351,23 +1353,13 @@
assertThat(actual)
.comparingElementsUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE)
.containsAtLeastElementsIn(expected);
- }
-
- @Test
- public void containsAllIn_array() {
- Integer[] expected = new Integer[] {64, 128, 256, 128};
- ImmutableList<String> actual =
- ImmutableList.of("fee", "+128", "+64", "fi", "fo", "0x80", "+256", "fum");
- assertThat(actual)
- .comparingElementsUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE)
- .containsAllIn(expected);
actual = ImmutableList.of("fee", "+64", "+128", "fi", "fo", "0x40", "0x80", "fum");
expectFailure
.whenTesting()
.that(actual)
.comparingElementsUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE)
- .containsAllIn(expected);
+ .containsAtLeastElementsIn(expected);
assertThat(expectFailure.getFailure())
.hasMessageThat()
.isEqualTo(
@@ -1387,33 +1379,33 @@
}
@Test
- public void containsAllOf_inOrder_success() {
+ public void containsAtLeast_inOrder_success() {
ImmutableList<String> actual =
ImmutableList.of("fee", "+64", "+128", "fi", "fo", "+256", "0x80", "fum");
assertThat(actual)
.comparingElementsUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE)
- .containsAllOf(64, 128, 256, 128)
+ .containsAtLeast(64, 128, 256, 128)
.inOrder();
}
@Test
- public void containsAllOf_successOutOfOrder() {
+ public void containsAtLeast_successOutOfOrder() {
ImmutableList<String> actual =
ImmutableList.of("fee", "+128", "+64", "fi", "fo", "0x80", "+256", "fum");
assertThat(actual)
.comparingElementsUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE)
- .containsAllOf(64, 128, 256, 128);
+ .containsAtLeast(64, 128, 256, 128);
}
@Test
- public void containsAllOf_failsMissingElementInOneToOne() {
+ public void containsAtLeast_failsMissingElementInOneToOne() {
ImmutableList<String> actual =
ImmutableList.of("fee", "+128", "fi", "fo", "+64", "+256", "fum");
expectFailure
.whenTesting()
.that(actual)
.comparingElementsUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE)
- .containsAllOf(64, 128, 256, 128);
+ .containsAtLeast(64, 128, 256, 128);
assertThat(expectFailure.getFailure())
.hasMessageThat()
.isEqualTo(
@@ -1426,11 +1418,11 @@
}
@Test
- public void containsAllOf_nullValueInArray() {
+ public void containsAtLeast_nullValueInArray() {
List<String> actual = Arrays.asList(null, "fee", "0x80");
assertThat(actual)
.comparingElementsUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE)
- .containsAllOf(128, null);
+ .containsAtLeast(128, null);
}
@Test
diff --git a/core/src/test/java/com/google/common/truth/IterableSubjectTest.java b/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
index db4005a..5eb694f 100644
--- a/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
+++ b/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
@@ -238,22 +238,22 @@
}
@Test
- public void iterableContainsAllOfWithMany() {
+ public void iterableContainsAtLeastWithMany() {
assertThat(asList(1, 2, 3)).containsAtLeast(1, 2);
}
@Test
- public void iterableContainsAllOfWithDuplicates() {
+ public void iterableContainsAtLeastWithDuplicates() {
assertThat(asList(1, 2, 2, 2, 3)).containsAtLeast(2, 2);
}
@Test
- public void iterableContainsAllOfWithNull() {
+ public void iterableContainsAtLeastWithNull() {
assertThat(asList(1, null, 3)).containsAtLeast(3, (Integer) null);
}
@Test
- public void iterableContainsAllOfWithNullAtThirdAndFinalPosition() {
+ public void iterableContainsAtLeastWithNullAtThirdAndFinalPosition() {
assertThat(asList(1, null, 3)).containsAtLeast(1, 3, (Object) null);
}
@@ -269,7 +269,7 @@
* to bite that off now. (Maybe Fact should catch exceptions from toString()?)
*/
@Test
- public void iterableContainsAllOutOfOrderDoesNotStringify() {
+ public void iterableContainsAtLeastElementsInOutOfOrderDoesNotStringify() {
CountsToStringCalls o = new CountsToStringCalls();
List<Object> actual = asList(o, 1);
List<Object> expected = asList(1, o);
@@ -280,7 +280,7 @@
}
@Test
- public void iterableContainsAllOfFailure() {
+ public void iterableContainsAtLeastFailure() {
expectFailureWhenTestingThat(asList(1, 2, 3)).containsAtLeast(1, 2, 4);
assertFailureKeys("missing (1)", "---", "expected to contain at least", "but was");
assertFailureValue("missing (1)", "4");
@@ -288,19 +288,19 @@
}
@Test
- public void iterableContainsAllOfWithExtras() {
+ public void iterableContainsAtLeastWithExtras() {
expectFailureWhenTestingThat(asList("y", "x")).containsAtLeast("x", "y", "z");
assertFailureValue("missing (1)", "z");
}
@Test
- public void iterableContainsAllOfWithExtraCopiesOfOutOfOrder() {
+ public void iterableContainsAtLeastWithExtraCopiesOfOutOfOrder() {
expectFailureWhenTestingThat(asList("y", "x")).containsAtLeast("x", "y", "y");
assertFailureValue("missing (1)", "y");
}
@Test
- public void iterableContainsAllOfWithDuplicatesFailure() {
+ public void iterableContainsAtLeastWithDuplicatesFailure() {
expectFailureWhenTestingThat(asList(1, 2, 3)).containsAtLeast(1, 2, 2, 2, 3, 4);
assertFailureValue("missing (3)", "2 [2 copies], 4");
}
@@ -310,40 +310,40 @@
* to be missing we only reference it once in the output message.
*/
@Test
- public void iterableContainsAllOfWithDuplicateMissingElements() {
+ public void iterableContainsAtLeastWithDuplicateMissingElements() {
expectFailureWhenTestingThat(asList(1, 2)).containsAtLeast(4, 4, 4);
assertFailureValue("missing (3)", "4 [3 copies]");
}
@Test
- public void iterableContainsAllOfWithNullFailure() {
+ public void iterableContainsAtLeastWithNullFailure() {
expectFailureWhenTestingThat(asList(1, null, 3)).containsAtLeast(1, null, null, 3);
assertFailureValue("missing (1)", "null");
}
@Test
- public void iterableContainsAllOfFailsWithSameToStringAndHomogeneousList() {
+ public void iterableContainsAtLeastFailsWithSameToStringAndHomogeneousList() {
expectFailureWhenTestingThat(asList(1L, 2L)).containsAtLeast(1, 2);
assertFailureValue("missing (2)", "1, 2 (java.lang.Integer)");
assertFailureValue("though it did contain (2)", "1, 2 (java.lang.Long)");
}
@Test
- public void iterableContainsAllOfFailsWithSameToStringAndHomogeneousListWithDuplicates() {
+ public void iterableContainsAtLeastFailsWithSameToStringAndHomogeneousListWithDuplicates() {
expectFailureWhenTestingThat(asList(1L, 2L, 2L)).containsAtLeast(1, 1, 2);
assertFailureValue("missing (3)", "1 [2 copies], 2 (java.lang.Integer)");
assertFailureValue("though it did contain (3)", "1, 2 [2 copies] (java.lang.Long)");
}
@Test
- public void iterableContainsAllOfFailsWithSameToStringAndHomogeneousListWithNull() {
+ public void iterableContainsAtLeastFailsWithSameToStringAndHomogeneousListWithNull() {
expectFailureWhenTestingThat(asList("null", "abc")).containsAtLeast("abc", null);
assertFailureValue("missing (1)", "null (null type)");
assertFailureValue("though it did contain (1)", "null (java.lang.String)");
}
@Test
- public void iterableContainsAllOfFailsWithSameToStringAndHeterogeneousListWithDuplicates() {
+ public void iterableContainsAtLeastFailsWithSameToStringAndHeterogeneousListWithDuplicates() {
expectFailureWhenTestingThat(asList(1, 2, 2L, 3L, 3L)).containsAtLeast(2L, 2L, 3, 3);
assertFailureValue("missing (3)", "2 (java.lang.Long), 3 (java.lang.Integer) [2 copies]");
assertFailureValue(
@@ -351,7 +351,7 @@
}
@Test
- public void iterableContainsAllOfFailsWithEmptyString() {
+ public void iterableContainsAtLeastFailsWithEmptyString() {
expectFailureWhenTestingThat(asList("a", null)).containsAtLeast("", null);
assertFailureKeys("missing (1)", "---", "expected to contain at least", "but was");
@@ -359,12 +359,12 @@
}
@Test
- public void iterableContainsAllOfInOrder() {
+ public void iterableContainsAtLeastInOrder() {
assertThat(asList(3, 2, 5)).containsAtLeast(3, 2, 5).inOrder();
}
@Test
- public void iterableContainsAllOfInOrderWithGaps() {
+ public void iterableContainsAtLeastInOrderWithGaps() {
assertThat(asList(3, 2, 5)).containsAtLeast(3, 5).inOrder();
assertThat(asList(3, 2, 2, 4, 5)).containsAtLeast(3, 2, 2, 5).inOrder();
assertThat(asList(3, 1, 4, 1, 5)).containsAtLeast(3, 1, 5).inOrder();
@@ -375,13 +375,13 @@
}
@Test
- public void iterableContainsAllOfInOrderWithNull() {
+ public void iterableContainsAtLeastInOrderWithNull() {
assertThat(asList(3, null, 5)).containsAtLeast(3, null, 5).inOrder();
assertThat(asList(3, null, 7, 5)).containsAtLeast(3, null, 5).inOrder();
}
@Test
- public void iterableContainsAllOfInOrderWithFailure() {
+ public void iterableContainsAtLeastInOrderWithFailure() {
expectFailureWhenTestingThat(asList(1, null, 3)).containsAtLeast(null, 1, 3).inOrder();
assertFailureKeys(
"required elements were all found, but order was wrong",
@@ -391,7 +391,7 @@
}
@Test
- public void iterableContainsAllOfInOrderWithOneShotIterable() {
+ public void iterableContainsAtLeastInOrderWithOneShotIterable() {
final Iterable<Object> iterable = Arrays.<Object>asList(2, 1, null, 4, "a", 3, "b");
final Iterator<Object> iterator = iterable.iterator();
Iterable<Object> oneShot =
@@ -411,7 +411,7 @@
}
@Test
- public void iterableContainsAllOfInOrderWithOneShotIterableWrongOrder() {
+ public void iterableContainsAtLeastInOrderWithOneShotIterableWrongOrder() {
final Iterator<Object> iterator = asList((Object) 2, 1, null, 4, "a", 3, "b").iterator();
Iterable<Object> iterable =
new Iterable<Object>() {
@@ -435,18 +435,13 @@
}
@Test
- public void iterableContainsAllOfInOrderWrongOrderAndMissing() {
+ public void iterableContainsAtLeastInOrderWrongOrderAndMissing() {
expectFailureWhenTestingThat(asList(1, 2)).containsAtLeast(2, 1, 3).inOrder();
}
@Test
public void iterableContainsAtLeastElementsInIterable() {
assertThat(asList(1, 2, 3)).containsAtLeastElementsIn(asList(1, 2));
- }
-
- @Test
- public void iterableContainsAllInIterable() {
- assertThat(asList(1, 2, 3)).containsAtLeastElementsIn(asList(1, 2));
expectFailureWhenTestingThat(asList(1, 2, 3)).containsAtLeastElementsIn(asList(1, 2, 4));
assertFailureKeys("missing (1)", "---", "expected to contain at least", "but was");
@@ -455,7 +450,7 @@
}
@Test
- public void iterableContainsAllInCanUseFactPerElement() {
+ public void iterableContainsAtLeastElementsInCanUseFactPerElement() {
expectFailureWhenTestingThat(asList("abc"))
.containsAtLeastElementsIn(asList("123\n456", "789"));
assertFailureKeys("missing (2)", "#1", "#2", "---", "expected to contain at least", "but was");
@@ -466,11 +461,6 @@
@Test
public void iterableContainsAtLeastElementsInArray() {
assertThat(asList(1, 2, 3)).containsAtLeastElementsIn(new Integer[] {1, 2});
- }
-
- @Test
- public void iterableContainsAllInArray() {
- assertThat(asList(1, 2, 3)).containsAtLeastElementsIn(new Integer[] {1, 2});
expectFailureWhenTestingThat(asList(1, 2, 3))
.containsAtLeastElementsIn(new Integer[] {1, 2, 4});
@@ -701,7 +691,7 @@
}
@Test
- public void iterableContainsExactlyElementsInErrorMessageIsOrdered() {
+ public void iterableContainsExactlyElementsInErrorMessageIsInOrder() {
expectFailureWhenTestingThat(asList("foo OR bar"))
.containsExactlyElementsIn(asList("foo", "bar"));
assertFailureValue("missing (2)", "foo, bar");
@@ -982,19 +972,11 @@
assertThat(asList()).isInStrictOrder();
assertThat(asList(1)).isInStrictOrder();
assertThat(asList(1, 2, 3, 4)).isInStrictOrder();
+ }
+
+ @Test
+ public void isInStrictOrderFailure() {
expectFailureWhenTestingThat(asList(1, 2, 2, 4)).isInStrictOrder();
- }
-
- @Test
- public void iterableIsStrictlyOrdered() {
- assertThat(asList()).isStrictlyOrdered();
- assertThat(asList(1)).isStrictlyOrdered();
- assertThat(asList(1, 2, 3, 4)).isStrictlyOrdered();
- }
-
- @Test
- public void isStrictlyOrderedFailure() {
- expectFailureWhenTestingThat(asList(1, 2, 2, 4)).isStrictlyOrdered();
assertFailureKeys(
"expected to be in strict order", "but contained", "followed by", "full contents");
assertFailureValue("but contained", "2");
@@ -1003,9 +985,9 @@
}
@Test
- public void isStrictlyOrderedWithNonComparableElementsFailure() {
+ public void isInStrictOrderWithNonComparableElementsFailure() {
try {
- assertThat(asList((Object) 1, "2", 3, "4")).isStrictlyOrdered();
+ assertThat(asList((Object) 1, "2", 3, "4")).isInStrictOrder();
fail("Should have thrown.");
} catch (ClassCastException expected) {
}
@@ -1016,19 +998,11 @@
assertThat(asList()).isInOrder();
assertThat(asList(1)).isInOrder();
assertThat(asList(1, 1, 2, 3, 3, 3, 4)).isInOrder();
+ }
+
+ @Test
+ public void isInOrderFailure() {
expectFailureWhenTestingThat(asList(1, 3, 2, 4)).isInOrder();
- }
-
- @Test
- public void iterableIsOrdered() {
- assertThat(asList()).isOrdered();
- assertThat(asList(1)).isOrdered();
- assertThat(asList(1, 1, 2, 3, 3, 3, 4)).isOrdered();
- }
-
- @Test
- public void isOrderedFailure() {
- expectFailureWhenTestingThat(asList(1, 3, 2, 4)).isOrdered();
assertFailureKeys("expected to be in order", "but contained", "followed by", "full contents");
assertFailureValue("but contained", "3");
assertFailureValue("followed by", "2");
@@ -1036,14 +1010,14 @@
}
@Test
- public void isOrderedMultipleFailures() {
- expectFailureWhenTestingThat(asList(1, 3, 2, 4, 0)).isOrdered();
+ public void isInOrderMultipleFailures() {
+ expectFailureWhenTestingThat(asList(1, 3, 2, 4, 0)).isInOrder();
}
@Test
- public void isOrderedWithNonComparableElementsFailure() {
+ public void isInOrderWithNonComparableElementsFailure() {
try {
- assertThat(asList((Object) 1, "2", 2, "3")).isOrdered();
+ assertThat(asList((Object) 1, "2", 2, "3")).isInOrder();
fail("Should have thrown.");
} catch (ClassCastException expected) {
}
@@ -1056,21 +1030,11 @@
assertThat(asList("1")).isInStrictOrder(COMPARE_AS_DECIMAL);
// Note: Use "10" and "20" to distinguish numerical and lexicographical ordering.
assertThat(asList("1", "2", "10", "20")).isInStrictOrder(COMPARE_AS_DECIMAL);
+ }
+
+ @Test
+ public void iterableIsInStrictOrderWithComparatorFailure() {
expectFailureWhenTestingThat(asList("1", "2", "2", "10")).isInStrictOrder(COMPARE_AS_DECIMAL);
- }
-
- @Test
- public void iterableIsStrictlyOrderedWithComparator() {
- Iterable<String> emptyStrings = asList();
- assertThat(emptyStrings).isStrictlyOrdered(COMPARE_AS_DECIMAL);
- assertThat(asList("1")).isStrictlyOrdered(COMPARE_AS_DECIMAL);
- // Note: Use "10" and "20" to distinguish numerical and lexicographical ordering.
- assertThat(asList("1", "2", "10", "20")).isStrictlyOrdered(COMPARE_AS_DECIMAL);
- }
-
- @Test
- public void iterableIsStrictlyOrderedWithComparatorFailure() {
- expectFailureWhenTestingThat(asList("1", "2", "2", "10")).isStrictlyOrdered(COMPARE_AS_DECIMAL);
assertFailureKeys(
"expected to be in strict order", "but contained", "followed by", "full contents");
assertFailureValue("but contained", "2");
@@ -1084,20 +1048,11 @@
assertThat(emptyStrings).isInOrder(COMPARE_AS_DECIMAL);
assertThat(asList("1")).isInOrder(COMPARE_AS_DECIMAL);
assertThat(asList("1", "1", "2", "10", "10", "10", "20")).isInOrder(COMPARE_AS_DECIMAL);
+ }
+
+ @Test
+ public void iterableIsInOrderWithComparatorFailure() {
expectFailureWhenTestingThat(asList("1", "10", "2", "20")).isInOrder(COMPARE_AS_DECIMAL);
- }
-
- @Test
- public void iterableIsOrderedWithComparator() {
- Iterable<String> emptyStrings = asList();
- assertThat(emptyStrings).isOrdered(COMPARE_AS_DECIMAL);
- assertThat(asList("1")).isOrdered(COMPARE_AS_DECIMAL);
- assertThat(asList("1", "1", "2", "10", "10", "10", "20")).isOrdered(COMPARE_AS_DECIMAL);
- }
-
- @Test
- public void iterableIsOrderedWithComparatorFailure() {
- expectFailureWhenTestingThat(asList("1", "10", "2", "20")).isOrdered(COMPARE_AS_DECIMAL);
assertFailureKeys("expected to be in order", "but contained", "followed by", "full contents");
assertFailureValue("but contained", "10");
assertFailureValue("followed by", "2");
@@ -1137,8 +1092,8 @@
@Test
public void iterableOrderedByBaseClassComparator() {
Iterable<Bar> targetList = asList(new Bar(1), new Bar(2), new Bar(3));
- assertThat(targetList).isOrdered(FOO_COMPARATOR);
- assertThat(targetList).isStrictlyOrdered(FOO_COMPARATOR);
+ assertThat(targetList).isInOrder(FOO_COMPARATOR);
+ assertThat(targetList).isInStrictOrder(FOO_COMPARATOR);
}
@Test
diff --git a/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java b/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
index b37e99a..13fcb06 100644
--- a/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
+++ b/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
@@ -358,7 +358,7 @@
ImmutableListMultimap<Integer, String> multimap =
ImmutableListMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four");
- assertThat(multimap).valuesForKey(4).isStrictlyOrdered();
+ assertThat(multimap).valuesForKey(4).isInStrictOrder();
}
@Test
diff --git a/core/src/test/java/com/google/common/truth/PrimitiveDoubleArraySubjectTest.java b/core/src/test/java/com/google/common/truth/PrimitiveDoubleArraySubjectTest.java
index 255bbb9..b90ea93 100644
--- a/core/src/test/java/com/google/common/truth/PrimitiveDoubleArraySubjectTest.java
+++ b/core/src/test/java/com/google/common/truth/PrimitiveDoubleArraySubjectTest.java
@@ -288,17 +288,17 @@
}
@Test
- public void usingTolerance_containsAllOf_primitiveDoubleArray_success() {
+ public void usingTolerance_containsAtLeast_primitiveDoubleArray_success() {
assertThat(array(1.1, TOLERABLE_2POINT2, 3.3))
.usingTolerance(DEFAULT_TOLERANCE)
- .containsAllOf(array(2.2, 1.1));
+ .containsAtLeast(array(2.2, 1.1));
}
@Test
- public void usingTolerance_containsAllOf_primitiveDoubleArray_failure() {
+ public void usingTolerance_containsAtLeast_primitiveDoubleArray_failure() {
expectFailureWhenTestingThat(array(1.1, TOLERABLE_2POINT2, 3.3))
.usingTolerance(DEFAULT_TOLERANCE)
- .containsAllOf(array(2.2, 99.99));
+ .containsAtLeast(array(2.2, 99.99));
assertThat(expectFailure.getFailure())
.hasMessageThat()
.isEqualTo(
@@ -314,18 +314,18 @@
}
@Test
- public void usingTolerance_containsAllOf_primitiveDoubleArray_inOrder_success() {
+ public void usingTolerance_containsAtLeast_primitiveDoubleArray_inOrder_success() {
assertThat(array(1.1, TOLERABLE_2POINT2, 3.3))
.usingTolerance(DEFAULT_TOLERANCE)
- .containsAllOf(array(1.1, 2.2))
+ .containsAtLeast(array(1.1, 2.2))
.inOrder();
}
@Test
- public void usingTolerance_containsAllOf_primitiveDoubleArray_inOrder_failure() {
+ public void usingTolerance_containsAtLeast_primitiveDoubleArray_inOrder_failure() {
expectFailureWhenTestingThat(array(1.1, TOLERABLE_2POINT2, 3.3))
.usingTolerance(DEFAULT_TOLERANCE)
- .containsAllOf(array(2.2, 1.1))
+ .containsAtLeast(array(2.2, 1.1))
.inOrder();
assertFailureKeys(
"value of",
@@ -570,15 +570,15 @@
}
@Test
- public void usingExactEquality_containsAllOf_primitiveDoubleArray_success() {
- assertThat(array(1.1, 2.2, 3.3)).usingExactEquality().containsAllOf(array(2.2, 1.1));
+ public void usingExactEquality_containsAtLeast_primitiveDoubleArray_success() {
+ assertThat(array(1.1, 2.2, 3.3)).usingExactEquality().containsAtLeast(array(2.2, 1.1));
}
@Test
- public void usingExactEquality_containsAllOf_primitiveDoubleArray_failure() {
+ public void usingExactEquality_containsAtLeast_primitiveDoubleArray_failure() {
expectFailureWhenTestingThat(array(1.1, 2.2, 3.3))
.usingExactEquality()
- .containsAllOf(array(2.2, 99.99));
+ .containsAtLeast(array(2.2, 99.99));
assertThat(expectFailure.getFailure())
.hasMessageThat()
.isEqualTo(
@@ -589,15 +589,18 @@
}
@Test
- public void usingExactEquality_containsAllOf_primitiveDoubleArray_inOrder_success() {
- assertThat(array(1.1, 2.2, 3.3)).usingExactEquality().containsAllOf(array(1.1, 2.2)).inOrder();
+ public void usingExactEquality_containsAtLeast_primitiveDoubleArray_inOrder_success() {
+ assertThat(array(1.1, 2.2, 3.3))
+ .usingExactEquality()
+ .containsAtLeast(array(1.1, 2.2))
+ .inOrder();
}
@Test
- public void usingExactEquality_containsAllOf_primitiveDoubleArray_inOrder_failure() {
+ public void usingExactEquality_containsAtLeast_primitiveDoubleArray_inOrder_failure() {
expectFailureWhenTestingThat(array(1.1, 2.2, 3.3))
.usingExactEquality()
- .containsAllOf(array(2.2, 1.1))
+ .containsAtLeast(array(2.2, 1.1))
.inOrder();
assertFailureKeys(
"value of",
diff --git a/core/src/test/java/com/google/common/truth/PrimitiveFloatArraySubjectTest.java b/core/src/test/java/com/google/common/truth/PrimitiveFloatArraySubjectTest.java
index 83531a5..2c1ab5b 100644
--- a/core/src/test/java/com/google/common/truth/PrimitiveFloatArraySubjectTest.java
+++ b/core/src/test/java/com/google/common/truth/PrimitiveFloatArraySubjectTest.java
@@ -282,17 +282,17 @@
}
@Test
- public void usingTolerance_containsAllOf_primitiveFloatArray_success() {
+ public void usingTolerance_containsAtLeast_primitiveFloatArray_success() {
assertThat(array(1.0f, TOLERABLE_TWO, 3.0f))
.usingTolerance(DEFAULT_TOLERANCE)
- .containsAllOf(array(2.0f, 1.0f));
+ .containsAtLeast(array(2.0f, 1.0f));
}
@Test
- public void usingTolerance_containsAllOf_primitiveFloatArray_failure() {
+ public void usingTolerance_containsAtLeast_primitiveFloatArray_failure() {
expectFailureWhenTestingThat(array(1.0f, TOLERABLE_TWO, 3.0f))
.usingTolerance(DEFAULT_TOLERANCE)
- .containsAllOf(array(2.0f, 99.99f));
+ .containsAtLeast(array(2.0f, 99.99f));
assertThat(expectFailure.getFailure())
.hasMessageThat()
.isEqualTo(
@@ -312,18 +312,18 @@
}
@Test
- public void usingTolerance_containsAllOf_primitiveFloatArray_inOrder_success() {
+ public void usingTolerance_containsAtLeast_primitiveFloatArray_inOrder_success() {
assertThat(array(1.0f, TOLERABLE_TWO, 3.0f))
.usingTolerance(DEFAULT_TOLERANCE)
- .containsAllOf(array(1.0f, 2.0f))
+ .containsAtLeast(array(1.0f, 2.0f))
.inOrder();
}
@Test
- public void usingTolerance_containsAllOf_primitiveFloatArray_inOrder_failure() {
+ public void usingTolerance_containsAtLeast_primitiveFloatArray_inOrder_failure() {
expectFailureWhenTestingThat(array(1.0f, TOLERABLE_TWO, 3.0f))
.usingTolerance(DEFAULT_TOLERANCE)
- .containsAllOf(array(2.0f, 1.0f))
+ .containsAtLeast(array(2.0f, 1.0f))
.inOrder();
assertFailureKeys(
"value of",
@@ -660,15 +660,15 @@
}
@Test
- public void usingExactEquality_containsAllOf_primitiveFloatArray_success() {
- assertThat(array(1.0f, 2.0f, 3.0f)).usingExactEquality().containsAllOf(array(2.0f, 1.0f));
+ public void usingExactEquality_containsAtLeast_primitiveFloatArray_success() {
+ assertThat(array(1.0f, 2.0f, 3.0f)).usingExactEquality().containsAtLeast(array(2.0f, 1.0f));
}
@Test
- public void usingExactEquality_containsAllOf_primitiveFloatArray_failure() {
+ public void usingExactEquality_containsAtLeast_primitiveFloatArray_failure() {
expectFailureWhenTestingThat(array(1.0f, 2.0f, 3.0f))
.usingExactEquality()
- .containsAllOf(array(2.0f, 99.99f));
+ .containsAtLeast(array(2.0f, 99.99f));
assertThat(expectFailure.getFailure())
.hasMessageThat()
.isEqualTo(
@@ -681,18 +681,18 @@
}
@Test
- public void usingExactEquality_containsAllOf_primitiveFloatArray_inOrder_success() {
+ public void usingExactEquality_containsAtLeast_primitiveFloatArray_inOrder_success() {
assertThat(array(1.0f, 2.0f, 3.0f))
.usingExactEquality()
- .containsAllOf(array(1.0f, 2.0f))
+ .containsAtLeast(array(1.0f, 2.0f))
.inOrder();
}
@Test
- public void usingExactEquality_containsAllOf_primitiveFloatArray_inOrder_failure() {
+ public void usingExactEquality_containsAtLeast_primitiveFloatArray_inOrder_failure() {
expectFailureWhenTestingThat(array(1.0f, 2.0f, 3.0f))
.usingExactEquality()
- .containsAllOf(array(2.0f, 1.0f))
+ .containsAtLeast(array(2.0f, 1.0f))
.inOrder();
assertFailureKeys(
"value of",
diff --git a/core/src/test/java/com/google/common/truth/SubjectTest.java b/core/src/test/java/com/google/common/truth/SubjectTest.java
index ac81696..1b98663 100644
--- a/core/src/test/java/com/google/common/truth/SubjectTest.java
+++ b/core/src/test/java/com/google/common/truth/SubjectTest.java
@@ -186,13 +186,13 @@
}
@Test
- public void isSameAsWithNulls() {
+ public void isSameInstanceAsWithNulls() {
Object o = null;
assertThat(o).isSameInstanceAs(null);
}
@Test
- public void isSameAsFailureWithNulls() {
+ public void isSameInstanceAsFailureWithNulls() {
Object o = null;
expectFailure.whenTesting().that(o).isSameInstanceAs("a");
assertFailureKeys("expected specific instance", "but was");
@@ -200,14 +200,14 @@
}
@Test
- public void isSameAsWithSameObject() {
+ public void isSameInstanceAsWithSameObject() {
Object a = new Object();
Object b = a;
assertThat(a).isSameInstanceAs(b);
}
@Test
- public void isSameAsFailureWithObjects() {
+ public void isSameInstanceAsFailureWithObjects() {
Object a = OBJECT_1;
Object b = OBJECT_2;
expectFailure.whenTesting().that(a).isSameInstanceAs(b);
@@ -215,7 +215,7 @@
}
@Test
- public void isSameAsFailureWithComparableObjects_nonString() {
+ public void isSameInstanceAsFailureWithComparableObjects_nonString() {
Object a = UnsignedInteger.valueOf(42);
Object b = UnsignedInteger.fromIntBits(42);
expectFailure.whenTesting().that(a).isSameInstanceAs(b);
@@ -227,14 +227,14 @@
@Test
@GwtIncompatible("String equality under JS")
- public void isSameAsFailureWithComparableObjects() {
+ public void isSameInstanceAsFailureWithComparableObjects() {
Object a = "ab";
Object b = new StringBuilder("ab").toString();
expectFailure.whenTesting().that(a).isSameInstanceAs(b);
}
@Test
- public void isSameAsFailureWithDifferentTypesAndSameToString() {
+ public void isSameInstanceAsFailureWithDifferentTypesAndSameToString() {
Object a = "true";
Object b = true;
expectFailure.whenTesting().that(a).isSameInstanceAs(b);
@@ -246,13 +246,13 @@
}
@Test
- public void isNotSameAsWithNulls() {
+ public void isNotSameInstanceAsWithNulls() {
Object o = null;
assertThat(o).isNotSameInstanceAs("a");
}
@Test
- public void isNotSameAsFailureWithNulls() {
+ public void isNotSameInstanceAsFailureWithNulls() {
Object o = null;
expectFailure.whenTesting().that(o).isNotSameInstanceAs(null);
assertFailureKeys("expected not to be specific instance");
@@ -260,14 +260,14 @@
}
@Test
- public void isNotSameAsWithObjects() {
+ public void isNotSameInstanceAsWithObjects() {
Object a = new Object();
Object b = new Object();
assertThat(a).isNotSameInstanceAs(b);
}
@Test
- public void isNotSameAsFailureWithSameObject() {
+ public void isNotSameInstanceAsFailureWithSameObject() {
Object a = OBJECT_1;
Object b = a;
expectFailure.whenTesting().that(a).isNotSameInstanceAs(b);
@@ -276,7 +276,7 @@
}
@Test
- public void isNotSameAsWithComparableObjects_nonString() {
+ public void isNotSameInstanceAsWithComparableObjects_nonString() {
Object a = UnsignedInteger.valueOf(42);
Object b = UnsignedInteger.fromIntBits(42);
assertThat(a).isNotSameInstanceAs(b);
@@ -284,14 +284,14 @@
@Test
@GwtIncompatible("String equality under JS")
- public void isNotSameAsWithComparableObjects() {
+ public void isNotSameInstanceAsWithComparableObjects() {
Object a = "ab";
Object b = new StringBuilder("ab").toString();
assertThat(a).isNotSameInstanceAs(b);
}
@Test
- public void isNotSameAsWithDifferentTypesAndSameToString() {
+ public void isNotSameInstanceAsWithDifferentTypesAndSameToString() {
Object a = "true";
Object b = true;
assertThat(a).isNotSameInstanceAs(b);
diff --git a/extensions/java8/src/main/java/com/google/common/truth/IntStreamSubject.java b/extensions/java8/src/main/java/com/google/common/truth/IntStreamSubject.java
index 98a45ec..77f289b 100644
--- a/extensions/java8/src/main/java/com/google/common/truth/IntStreamSubject.java
+++ b/extensions/java8/src/main/java/com/google/common/truth/IntStreamSubject.java
@@ -135,41 +135,6 @@
}
/**
- * Fails if the subject does not contain all of the given elements. If an element appears more
- * than once in the given elements, then it must appear at least that number of times in the
- * actual elements.
- *
- * <p>To also test that the contents appear in the given order, make a call to {@code inOrder()}
- * on the object returned by this method. The expected elements must appear in the given order
- * within the actual elements, but they are not required to be consecutive.
- *
- * @deprecated Use {@link #containsAtLeast}, which is equivalent.
- */
- @Deprecated
- @SuppressWarnings("GoodTime") // false positive; b/122617528
- @CanIgnoreReturnValue
- public Ordered containsAllOf(int first, int second, int... rest) {
- return containsAtLeast(first, second, rest);
- }
-
- /**
- * Fails if the subject does not contain all of the given elements. If an element appears more
- * than once in the given elements, then it must appear at least that number of times in the
- * actual elements.
- *
- * <p>To also test that the contents appear in the given order, make a call to {@code inOrder()}
- * on the object returned by this method. The expected elements must appear in the given order
- * within the actual elements, but they are not required to be consecutive.
- *
- * @deprecated Use {@link #containsAtLeastElementsIn(Iterable)}, which is equivalent.
- */
- @CanIgnoreReturnValue
- @Deprecated
- public Ordered containsAllIn(Iterable<?> expected) {
- return containsAtLeastElementsIn(expected);
- }
-
- /**
* Fails if the subject does not contain exactly the given elements.
*
* <p>Multiplicity is respected. For example, an object duplicated exactly 3 times in the
diff --git a/extensions/java8/src/main/java/com/google/common/truth/LongStreamSubject.java b/extensions/java8/src/main/java/com/google/common/truth/LongStreamSubject.java
index a4c6af3..4c22ce6 100644
--- a/extensions/java8/src/main/java/com/google/common/truth/LongStreamSubject.java
+++ b/extensions/java8/src/main/java/com/google/common/truth/LongStreamSubject.java
@@ -135,41 +135,6 @@
}
/**
- * Fails if the subject does not contain all of the given elements. If an element appears more
- * than once in the given elements, then it must appear at least that number of times in the
- * actual elements.
- *
- * <p>To also test that the contents appear in the given order, make a call to {@code inOrder()}
- * on the object returned by this method. The expected elements must appear in the given order
- * within the actual elements, but they are not required to be consecutive.
- *
- * @deprecated Use {@link #containsAtLeast}, which is equivalent.
- */
- @SuppressWarnings("GoodTime") // false positive; b/122617528
- @CanIgnoreReturnValue
- @Deprecated
- public Ordered containsAllOf(long first, long second, long... rest) {
- return containsAtLeast(first, second, rest);
- }
-
- /**
- * Fails if the subject does not contain all of the given elements. If an element appears more
- * than once in the given elements, then it must appear at least that number of times in the
- * actual elements.
- *
- * <p>To also test that the contents appear in the given order, make a call to {@code inOrder()}
- * on the object returned by this method. The expected elements must appear in the given order
- * within the actual elements, but they are not required to be consecutive.
- *
- * @deprecated Use {@link #containsAtLeastElementsIn(Iterable)}, which is equivalent.
- */
- @CanIgnoreReturnValue
- @Deprecated
- public Ordered containsAllIn(Iterable<?> expected) {
- return containsAtLeastElementsIn(expected);
- }
-
- /**
* Fails if the subject does not contain exactly the given elements.
*
* <p>Multiplicity is respected. For example, an object duplicated exactly 3 times in the
diff --git a/extensions/java8/src/main/java/com/google/common/truth/StreamSubject.java b/extensions/java8/src/main/java/com/google/common/truth/StreamSubject.java
index 3bcc2cb..4b1e978 100644
--- a/extensions/java8/src/main/java/com/google/common/truth/StreamSubject.java
+++ b/extensions/java8/src/main/java/com/google/common/truth/StreamSubject.java
@@ -135,41 +135,6 @@
// TODO(cpovirk): Add array overload of contains*ElementsIn methods? Also for int and long stream.
/**
- * Fails if the subject does not contain all of the given elements. If an element appears more
- * than once in the given elements, then it must appear at least that number of times in the
- * actual elements.
- *
- * <p>To also test that the contents appear in the given order, make a call to {@code inOrder()}
- * on the object returned by this method. The expected elements must appear in the given order
- * within the actual elements, but they are not required to be consecutive.
- *
- * @deprecated Use {@link #containsAtLeast}, which is equivalent.
- */
- @CanIgnoreReturnValue
- @Deprecated
- public Ordered containsAllOf(
- @NullableDecl Object first, @NullableDecl Object second, @NullableDecl Object... rest) {
- return containsAtLeast(first, second, rest);
- }
-
- /**
- * Fails if the subject does not contain all of the given elements. If an element appears more
- * than once in the given elements, then it must appear at least that number of times in the
- * actual elements.
- *
- * <p>To also test that the contents appear in the given order, make a call to {@code inOrder()}
- * on the object returned by this method. The expected elements must appear in the given order
- * within the actual elements, but they are not required to be consecutive.
- *
- * @deprecated Use {@link #containsAtLeastElementsIn(Iterable)}, which is equivalent.
- */
- @CanIgnoreReturnValue
- @Deprecated
- public Ordered containsAllIn(Iterable<?> expected) {
- return containsAtLeastElementsIn(expected);
- }
-
- /**
* Fails if the subject does not contain exactly the given elements.
*
* <p>Multiplicity is respected. For example, an object duplicated exactly 3 times in the
diff --git a/extensions/java8/src/test/java/com/google/common/truth/IntStreamSubjectTest.java b/extensions/java8/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
index 873abb8..bcb11bd 100644
--- a/extensions/java8/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
+++ b/extensions/java8/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
@@ -66,7 +66,7 @@
}
@Test
- public void testIsSameAs() throws Exception {
+ public void testIsSameInstanceAs() throws Exception {
IntStream stream = IntStream.of(1);
assertThat(stream).isSameInstanceAs(stream);
}
@@ -196,26 +196,14 @@
}
@Test
- public void testContainsAllOf() throws Exception {
- assertThat(IntStream.of(42, 43)).containsAllOf(42, 43);
+ public void testContainsAtLeast_inOrder() throws Exception {
+ assertThat(IntStream.of(42, 43)).containsAtLeast(42, 43).inOrder();
}
@Test
- public void testContainsAllOf_fails() throws Exception {
- AssertionError unused =
- expectFailure(
- whenTesting -> whenTesting.that(IntStream.of(42, 43)).containsAllOf(42, 43, 44));
- }
-
- @Test
- public void testContainsAllOf_inOrder() throws Exception {
- assertThat(IntStream.of(42, 43)).containsAllOf(42, 43).inOrder();
- }
-
- @Test
- public void testContainsAllOf_inOrder_fails() throws Exception {
+ public void testContainsAtLeast_inOrder_fails() throws Exception {
try {
- assertThat(IntStream.of(42, 43)).containsAllOf(43, 42).inOrder();
+ assertThat(IntStream.of(42, 43)).containsAtLeast(43, 42).inOrder();
fail();
} catch (AssertionError expected) {
assertFailureKeys(
@@ -243,27 +231,14 @@
}
@Test
- public void testContainsAllIn() throws Exception {
- assertThat(IntStream.of(42, 43)).containsAllIn(asList(42, 43));
+ public void testContainsAtLeastElementsIn_inOrder() throws Exception {
+ assertThat(IntStream.of(42, 43)).containsAtLeastElementsIn(asList(42, 43)).inOrder();
}
@Test
- public void testContainsAllIn_fails() throws Exception {
- AssertionError unused =
- expectFailure(
- whenTesting ->
- whenTesting.that(IntStream.of(42, 43)).containsAllIn(asList(42, 43, 44)));
- }
-
- @Test
- public void testContainsAllIn_inOrder() throws Exception {
- assertThat(IntStream.of(42, 43)).containsAllIn(asList(42, 43)).inOrder();
- }
-
- @Test
- public void testContainsAllIn_inOrder_fails() throws Exception {
+ public void testContainsAtLeastElementsIn_inOrder_fails() throws Exception {
try {
- assertThat(IntStream.of(42, 43)).containsAllIn(asList(43, 42)).inOrder();
+ assertThat(IntStream.of(42, 43)).containsAtLeastElementsIn(asList(43, 42)).inOrder();
fail();
} catch (AssertionError expected) {
assertFailureKeys(
diff --git a/extensions/java8/src/test/java/com/google/common/truth/LongStreamSubjectTest.java b/extensions/java8/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
index f776c5f..9908b35 100644
--- a/extensions/java8/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
+++ b/extensions/java8/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
@@ -66,7 +66,7 @@
}
@Test
- public void testIsSameAs() throws Exception {
+ public void testIsSameInstanceAs() throws Exception {
LongStream stream = LongStream.of(1);
assertThat(stream).isSameInstanceAs(stream);
}
@@ -197,26 +197,14 @@
}
@Test
- public void testContainsAllOf() throws Exception {
- assertThat(LongStream.of(42, 43)).containsAllOf(42, 43);
+ public void testContainsAtLeast_inOrder() throws Exception {
+ assertThat(LongStream.of(42, 43)).containsAtLeast(42, 43).inOrder();
}
@Test
- public void testContainsAllOf_fails() throws Exception {
- AssertionError unused =
- expectFailure(
- whenTesting -> whenTesting.that(LongStream.of(42, 43)).containsAllOf(42, 43, 44));
- }
-
- @Test
- public void testContainsAllOf_inOrder() throws Exception {
- assertThat(LongStream.of(42, 43)).containsAllOf(42, 43).inOrder();
- }
-
- @Test
- public void testContainsAllOf_inOrder_fails() throws Exception {
+ public void testContainsAtLeast_inOrder_fails() throws Exception {
try {
- assertThat(LongStream.of(42, 43)).containsAllOf(43, 42).inOrder();
+ assertThat(LongStream.of(42, 43)).containsAtLeast(43, 42).inOrder();
fail();
} catch (AssertionError expected) {
assertFailureKeys(
@@ -244,35 +232,24 @@
}
@Test
- public void testContainsAllIn() throws Exception {
- assertThat(LongStream.of(42, 43)).containsAllIn(asList(42L, 43L));
- }
-
- @Test
- public void testContainsAllIn_fails() throws Exception {
+ public void testContainsAtLeastElementsIn_wrongType_fails() throws Exception {
AssertionError unused =
expectFailure(
whenTesting ->
- whenTesting.that(LongStream.of(42, 43)).containsAllIn(asList(42L, 43L, 44L)));
+ whenTesting
+ .that(LongStream.of(42, 43))
+ .containsAtLeastElementsIn(asList(42, 43, 44)));
}
@Test
- public void testContainsAllIn_wrongType_fails() throws Exception {
- AssertionError unused =
- expectFailure(
- whenTesting ->
- whenTesting.that(LongStream.of(42, 43)).containsAllIn(asList(42, 43, 44)));
+ public void testContainsAtLeastElementsIn_inOrder() throws Exception {
+ assertThat(LongStream.of(42, 43)).containsAtLeastElementsIn(asList(42L, 43L)).inOrder();
}
@Test
- public void testContainsAllIn_inOrder() throws Exception {
- assertThat(LongStream.of(42, 43)).containsAllIn(asList(42L, 43L)).inOrder();
- }
-
- @Test
- public void testContainsAllIn_inOrder_fails() throws Exception {
+ public void testContainsAtLeastElementsIn_inOrder_fails() throws Exception {
try {
- assertThat(LongStream.of(42, 43)).containsAllIn(asList(43L, 42L)).inOrder();
+ assertThat(LongStream.of(42, 43)).containsAtLeastElementsIn(asList(43L, 42L)).inOrder();
fail();
} catch (AssertionError expected) {
assertFailureKeys(
@@ -285,11 +262,14 @@
}
@Test
- public void testContainsAllIn_inOrder_wrongType_fails() throws Exception {
+ public void testContainsAtLeastElementsIn_inOrder_wrongType_fails() throws Exception {
AssertionError unused =
expectFailure(
whenTesting ->
- whenTesting.that(LongStream.of(42, 43)).containsAllIn(asList(43, 42)).inOrder());
+ whenTesting
+ .that(LongStream.of(42, 43))
+ .containsAtLeastElementsIn(asList(43, 42))
+ .inOrder());
}
@Test
diff --git a/extensions/java8/src/test/java/com/google/common/truth/StreamSubjectTest.java b/extensions/java8/src/test/java/com/google/common/truth/StreamSubjectTest.java
index 9ec3766..b685e71 100644
--- a/extensions/java8/src/test/java/com/google/common/truth/StreamSubjectTest.java
+++ b/extensions/java8/src/test/java/com/google/common/truth/StreamSubjectTest.java
@@ -66,7 +66,7 @@
}
@Test
- public void testIsSameAs() throws Exception {
+ public void testIsSameInstanceAs() throws Exception {
Stream<String> stream = Stream.of("hello");
assertThat(stream).isSameInstanceAs(stream);
}
@@ -204,29 +204,14 @@
}
@Test
- public void testContainsAllOf() throws Exception {
- assertThat(Stream.of("hell", "hello")).containsAllOf("hell", "hello");
+ public void testContainsAtLeast_inOrder() throws Exception {
+ assertThat(Stream.of("hell", "hello")).containsAtLeast("hell", "hello").inOrder();
}
@Test
- public void testContainsAllOf_fails() throws Exception {
- AssertionError unused =
- expectFailure(
- whenTesting ->
- whenTesting
- .that(Stream.of("hell", "hello"))
- .containsAllOf("hell", "hello", "goodbye"));
- }
-
- @Test
- public void testContainsAllOf_inOrder() throws Exception {
- assertThat(Stream.of("hell", "hello")).containsAllOf("hell", "hello").inOrder();
- }
-
- @Test
- public void testContainsAllOf_inOrder_fails() throws Exception {
+ public void testContainsAtLeast_inOrder_fails() throws Exception {
try {
- assertThat(Stream.of("hell", "hello")).containsAllOf("hello", "hell").inOrder();
+ assertThat(Stream.of("hell", "hello")).containsAtLeast("hello", "hell").inOrder();
fail();
} catch (AssertionError expected) {
assertFailureKeys(
@@ -254,29 +239,18 @@
}
@Test
- public void testContainsAllIn() throws Exception {
- assertThat(Stream.of("hell", "hello")).containsAllIn(asList("hell", "hello"));
+ public void testContainsAtLeastElementsIn_inOrder() throws Exception {
+ assertThat(Stream.of("hell", "hello"))
+ .containsAtLeastElementsIn(asList("hell", "hello"))
+ .inOrder();
}
@Test
- public void testContainsAllIn_fails() throws Exception {
- AssertionError unused =
- expectFailure(
- whenTesting ->
- whenTesting
- .that(Stream.of("hell", "hello"))
- .containsAllIn(asList("hell", "hello", "goodbye")));
- }
-
- @Test
- public void testContainsAllIn_inOrder() throws Exception {
- assertThat(Stream.of("hell", "hello")).containsAllIn(asList("hell", "hello")).inOrder();
- }
-
- @Test
- public void testContainsAllIn_inOrder_fails() throws Exception {
+ public void testContainsAtLeastElementsIn_inOrder_fails() throws Exception {
try {
- assertThat(Stream.of("hell", "hello")).containsAllIn(asList("hello", "hell")).inOrder();
+ assertThat(Stream.of("hell", "hello"))
+ .containsAtLeastElementsIn(asList("hello", "hell"))
+ .inOrder();
fail();
} catch (AssertionError expected) {
assertFailureKeys(
diff --git a/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java b/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
index c91bd59..c790821 100644
--- a/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
+++ b/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
@@ -742,25 +742,6 @@
}
@Override
- @CanIgnoreReturnValue
- public Ordered containsAllOf(
- @NullableDecl M first, @NullableDecl M second, @NullableDecl M... rest) {
- return containsAtLeast(first, second, rest);
- }
-
- @Override
- @CanIgnoreReturnValue
- public Ordered containsAllIn(Iterable<? extends M> expected) {
- return containsAtLeastElementsIn(expected);
- }
-
- @Override
- @CanIgnoreReturnValue
- public Ordered containsAllIn(M[] expected) {
- return containsAtLeastElementsIn(expected);
- }
-
- @Override
public void containsAnyOf(
@NullableDecl M first, @NullableDecl M second, @NullableDecl M... rest) {
delegate(Lists.asList(first, second, rest)).containsAnyOf(first, second, rest);
@@ -1048,22 +1029,6 @@
}
@Override
- public Ordered containsAllOf(
- @NullableDecl M first, @NullableDecl M second, @NullableDecl M... rest) {
- return containsAtLeast(first, second, rest);
- }
-
- @Override
- public Ordered containsAllIn(Iterable<? extends M> expected) {
- return containsAtLeastElementsIn(expected);
- }
-
- @Override
- public Ordered containsAllIn(M[] expected) {
- return containsAtLeastElementsIn(expected);
- }
-
- @Override
public void containsAnyOf(
@NullableDecl M first, @NullableDecl M second, @NullableDecl M... rest) {
usingCorrespondence().containsAnyOf(first, second, rest);
diff --git a/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosUsingCorrespondence.java b/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosUsingCorrespondence.java
index 8f06c86..9459dce 100644
--- a/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosUsingCorrespondence.java
+++ b/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosUsingCorrespondence.java
@@ -144,51 +144,6 @@
Ordered containsAtLeastElementsIn(M[] expected);
/**
- * Checks that the subject contains elements that corresponds to all of the expected elements,
- * i.e. that there is a 1:1 mapping between any subset of the actual elements and the expected
- * elements where each pair of elements correspond.
- *
- * <p>To also test that the contents appear in the given order, make a call to {@code inOrder()}
- * on the object returned by this method. The elements must appear in the given order within the
- * subject, but they are not required to be consecutive.
- *
- * @deprecated Use {@link #containsAtLeast}, which is equivalent.
- */
- @CanIgnoreReturnValue
- @Deprecated
- Ordered containsAllOf(@NullableDecl M first, @NullableDecl M second, @NullableDecl M... rest);
-
- /**
- * Checks that the subject contains elements that corresponds to all of the expected elements,
- * i.e. that there is a 1:1 mapping between any subset of the actual elements and the expected
- * elements where each pair of elements correspond.
- *
- * <p>To also test that the contents appear in the given order, make a call to {@code inOrder()}
- * on the object returned by this method. The elements must appear in the given order within the
- * subject, but they are not required to be consecutive.
- *
- * @deprecated Use {@link #containsAtLeastElementsIn(Iterable)}, which is equivalent.
- */
- @CanIgnoreReturnValue
- @Deprecated
- Ordered containsAllIn(Iterable<? extends M> expected);
-
- /**
- * Checks that the subject contains elements that corresponds to all of the expected elements,
- * i.e. that there is a 1:1 mapping between any subset of the actual elements and the expected
- * elements where each pair of elements correspond.
- *
- * <p>To also test that the contents appear in the given order, make a call to {@code inOrder()}
- * on the object returned by this method. The elements must appear in the given order within the
- * subject, but they are not required to be consecutive.
- *
- * @deprecated Use {@link #containsAtLeastElementsIn(Object[])}, which is equivalent.
- */
- @CanIgnoreReturnValue
- @Deprecated
- Ordered containsAllIn(M[] expected);
-
- /**
* Checks that the subject contains at least one element that corresponds to at least one of the
* expected elements.
*/
diff --git a/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/ProtoTruthMessageDifferencer.java b/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/ProtoTruthMessageDifferencer.java
index d83a24f..27ba187 100644
--- a/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/ProtoTruthMessageDifferencer.java
+++ b/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/ProtoTruthMessageDifferencer.java
@@ -355,7 +355,7 @@
// Search for expectedList as a subsequence of actualList.
//
- // This mostly replicates the algorithm used by IterableSubject.containsAll().inOrder(), but
+ // This mostly replicates the algorithm used by IterableSubject.containsAtLeast().inOrder(), but
// with some tweaks for fuzzy equality and structured output.
Deque<Integer> actualIndices = new ArrayDeque<>();
for (int i = 0; i < actualList.size(); i++) {
diff --git a/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java b/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
index ab57503..ebd2e00 100644
--- a/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
+++ b/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
@@ -120,26 +120,6 @@
}
@Test
- public void testPlain_containsAll() {
- expectThat(listOf(message1, message2, eqIgnoredMessage1)).containsAllOf(eqMessage1, eqMessage2);
- expectThat(listOf(message1, message2, eqIgnoredMessage1))
- .containsAllIn(listOf(eqMessage1, eqMessage2));
- expectThat(listOf(message1, message2, eqIgnoredMessage1))
- .containsAllIn(arrayOf(eqMessage1, eqMessage2));
-
- expectFailureWhenTesting().that(listOf(message1)).containsAllOf(eqMessage1, eqMessage2);
- expectThatFailure().isNotNull();
-
- expectFailureWhenTesting().that(listOf(message1)).containsAllIn(listOf(eqMessage1, eqMessage2));
- expectThatFailure().isNotNull();
-
- expectFailureWhenTesting()
- .that(listOf(message1))
- .containsAllIn(arrayOf(eqMessage1, eqMessage2));
- expectThatFailure().isNotNull();
- }
-
- @Test
public void testPlain_containsAtLeast() {
expectThat(listOf(message1, message2, eqIgnoredMessage1))
.containsAtLeast(eqMessage1, eqMessage2);
@@ -246,20 +226,6 @@
}
@Test
- public void testPlain_isOrdered() {
- expectThat(listOf(message1, eqMessage1, message2)).isOrdered(compareByOIntAscending());
- expectThat(listOf(message1, message2)).isStrictlyOrdered(compareByOIntAscending());
-
- expectFailureWhenTesting().that(listOf(message2, message1)).isOrdered(compareByOIntAscending());
- expectThatFailure().isNotNull();
-
- expectFailureWhenTesting()
- .that(listOf(message1, eqMessage1, message2))
- .isStrictlyOrdered(compareByOIntAscending());
- expectThatFailure().isNotNull();
- }
-
- @Test
public void testFluent_contains() {
expectThat(listOf(message1, message2))
.ignoringFields(ignoreFieldNumber)
@@ -328,31 +294,6 @@
}
@Test
- public void testFluent_containsAll() {
- // TODO(peteg): containsAll and containsExactly don't surface Correspondence.toString().
- // We should add a string test here once they do.
-
- expectThat(listOf(message1, message2, eqRepeatedMessage2))
- .ignoringFields(ignoreFieldNumber)
- .containsAllOf(eqIgnoredMessage1, eqIgnoredMessage2);
- expectThat(listOf(message1, message2, eqIgnoredMessage1))
- .ignoringRepeatedFieldOrder()
- .containsAllIn(listOf(eqRepeatedMessage1, eqRepeatedMessage2));
-
- expectFailureWhenTesting()
- .that(listOf(message1))
- .ignoringRepeatedFieldOrder()
- .containsAllOf(eqMessage1, eqMessage2);
- expectThatFailure().isNotNull();
-
- expectFailureWhenTesting()
- .that(listOf(message1))
- .ignoringRepeatedFieldOrder()
- .containsAllIn(listOf(eqMessage1, eqMessage2));
- expectThatFailure().isNotNull();
- }
-
- @Test
public void testFluent_containsAtLeast() {
// TODO(peteg): containsAtLeast and containsExactly don't surface Correspondence.toString().
// We should add a string test here once they do.