code
stringlengths
23
201k
docstring
stringlengths
17
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
72
path
stringlengths
11
317
url
stringlengths
57
377
license
stringclasses
7 values
@Test public void testContains() { assertThat(IntStream.of(42)).contains(42); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContains
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContains_fails() { AssertionError unused = expectFailure(whenTesting -> whenTesting.that(IntStream.of(42)).contains(100)); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContains_fails
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsAnyOf() { assertThat(IntStream.of(42)).containsAnyOf(42, 43); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsAnyOf
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsAnyOf_fails() { AssertionError unused = expectFailure(whenTesting -> whenTesting.that(IntStream.of(42)).containsAnyOf(43, 44)); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsAnyOf_fails
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsAnyIn() { assertThat(IntStream.of(42)).containsAnyIn(asList(42, 43)); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsAnyIn
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsAnyIn_fails() { AssertionError unused = expectFailure( whenTesting -> whenTesting.that(IntStream.of(42)).containsAnyIn(asList(43, 44))); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsAnyIn_fails
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testDoesNotContain() { assertThat(IntStream.of(42)).doesNotContain(43); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testDoesNotContain
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testDoesNotContain_fails() { AssertionError unused = expectFailure(whenTesting -> whenTesting.that(IntStream.of(42)).doesNotContain(42)); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testDoesNotContain_fails
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsNoneOf() { assertThat(IntStream.of(42)).containsNoneOf(43, 44); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsNoneOf
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsNoneOf_fails() { AssertionError unused = expectFailure(whenTesting -> whenTesting.that(IntStream.of(42)).containsNoneOf(42, 43)); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsNoneOf_fails
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsNoneIn() { assertThat(IntStream.of(42)).containsNoneIn(asList(43, 44)); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsNoneIn
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsNoneIn_fails() { AssertionError unused = expectFailure( whenTesting -> whenTesting.that(IntStream.of(42)).containsNoneIn(asList(42, 43))); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsNoneIn_fails
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsAtLeast() { assertThat(IntStream.of(42, 43)).containsAtLeast(42, 43); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsAtLeast
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsAtLeast_fails() { AssertionError unused = expectFailure( whenTesting -> whenTesting.that(IntStream.of(42, 43)).containsAtLeast(42, 43, 44)); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsAtLeast_fails
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsAtLeast_inOrder() { assertThat(IntStream.of(42, 43)).containsAtLeast(42, 43).inOrder(); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsAtLeast_inOrder
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsAtLeast_inOrder_fails() { AssertionError expected = expectFailure( whenTesting -> whenTesting.that(IntStream.of(42, 43)).containsAtLeast(43, 42).inOrder()); assertFailureKeys( expected, "required elements were all found, but order was wrong", "expected order for required elements", "but was"); assertFailureValue(expected, "expected order for required elements", "[43, 42]"); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsAtLeast_inOrder_fails
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsAtLeastElementsIn() { assertThat(IntStream.of(42, 43)).containsAtLeastElementsIn(asList(42, 43)); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsAtLeastElementsIn
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsAtLeastElementsIn_fails() { AssertionError unused = expectFailure( whenTesting -> whenTesting .that(IntStream.of(42, 43)) .containsAtLeastElementsIn(asList(42, 43, 44))); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsAtLeastElementsIn_fails
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsAtLeastElementsIn_inOrder() { assertThat(IntStream.of(42, 43)).containsAtLeastElementsIn(asList(42, 43)).inOrder(); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsAtLeastElementsIn_inOrder
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsAtLeastElementsIn_inOrder_fails() { AssertionError expected = expectFailure( whenTesting -> whenTesting .that(IntStream.of(42, 43)) .containsAtLeastElementsIn(asList(43, 42)) .inOrder()); assertFailureKeys( expected, "required elements were all found, but order was wrong", "expected order for required elements", "but was"); assertFailureValue(expected, "expected order for required elements", "[43, 42]"); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsAtLeastElementsIn_inOrder_fails
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsExactly() { assertThat(IntStream.of(42, 43)).containsExactly(42, 43); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsExactly
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsExactly_fails() { AssertionError expected = expectFailure(whenTesting -> whenTesting.that(IntStream.of(42, 43)).containsExactly(42)); assertFailureKeys(expected, "unexpected (1)", "---", "expected", "but was"); assertFailureValue(expected, "expected", "[42]"); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsExactly_fails
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsExactly_inOrder() { assertThat(IntStream.of(42, 43)).containsExactly(42, 43).inOrder(); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsExactly_inOrder
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsExactly_inOrder_fails() { AssertionError expected = expectFailure( whenTesting -> whenTesting.that(IntStream.of(42, 43)).containsExactly(43, 42).inOrder()); assertFailureKeys(expected, "contents match, but order was wrong", "expected", "but was"); assertFailureValue(expected, "expected", "[43, 42]"); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsExactly_inOrder_fails
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsExactlyElementsIn() { assertThat(IntStream.of(42, 43)).containsExactlyElementsIn(asList(42, 43)); assertThat(IntStream.of(42, 43)).containsExactlyElementsIn(asList(43, 42)); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsExactlyElementsIn
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsExactlyElementsIn_fails() { AssertionError expected = expectFailure( whenTesting -> whenTesting.that(IntStream.of(42, 43)).containsExactlyElementsIn(asList(42))); assertFailureKeys(expected, "unexpected (1)", "---", "expected", "but was"); assertFailureValue(expected, "expected", "[42]"); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsExactlyElementsIn_fails
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsExactlyElementsIn_inOrder() { assertThat(IntStream.of(42, 43)).containsExactlyElementsIn(asList(42, 43)).inOrder(); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsExactlyElementsIn_inOrder
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsExactlyElementsIn_inOrder_fails() { AssertionError expected = expectFailure( whenTesting -> whenTesting .that(IntStream.of(42, 43)) .containsExactlyElementsIn(asList(43, 42)) .inOrder()); assertFailureKeys(expected, "contents match, but order was wrong", "expected", "but was"); assertFailureValue(expected, "expected", "[43, 42]"); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsExactlyElementsIn_inOrder_fails
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testContainsExactlyElementsIn_inOrder_intStream() { assertThat(IntStream.of(1, 2, 3, 4)).containsExactly(1, 2, 3, 4).inOrder(); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testContainsExactlyElementsIn_inOrder_intStream
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testIsInOrder() { assertThat(IntStream.of()).isInOrder(); assertThat(IntStream.of(1)).isInOrder(); assertThat(IntStream.of(1, 1, 2, 3, 3, 3, 4)).isInOrder(); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testIsInOrder
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testIsInOrder_fails() { AssertionError unused = expectFailure(whenTesting -> whenTesting.that(IntStream.of(1, 3, 2, 4)).isInOrder()); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testIsInOrder_fails
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testIsInStrictOrder() { assertThat(IntStream.of()).isInStrictOrder(); assertThat(IntStream.of(1)).isInStrictOrder(); assertThat(IntStream.of(1, 2, 3, 4)).isInStrictOrder(); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testIsInStrictOrder
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void testIsInStrictOrder_fails() { AssertionError unused = expectFailure(whenTesting -> whenTesting.that(IntStream.of(1, 2, 2, 4)).isInStrictOrder()); }
Tests for {@link IntStream} Subjects. @author Kurt Alfred Kluever
testIsInStrictOrder_fails
java
google/truth
core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IntStreamSubjectTest.java
Apache-2.0
@Test public void hasSize() { assertThat(ImmutableList.of(1, 2, 3)).hasSize(3); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
hasSize
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test @SuppressWarnings({"TruthIterableIsEmpty", "IsEmptyTruth"}) public void hasSizeZero() { assertThat(ImmutableList.of()).hasSize(0); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
hasSizeZero
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void hasSizeFails() { AssertionError e = expectFailure(whenTesting -> whenTesting.that(ImmutableList.of(1, 2, 3)).hasSize(4)); assertFailureValue(e, "value of", "iterable.size()"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
hasSizeFails
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void hasSizeNegative() { assertThrows( IllegalArgumentException.class, () -> assertThat(ImmutableList.of(1, 2, 3)).hasSize(-1)); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
hasSizeNegative
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContains() { assertThat(asList(1, 2, 3)).contains(1); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContains
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsWithNull() { assertThat(asList(1, null, 3)).contains(null); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsWithNull
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsFailsWithSameToString() { AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList(1L, 2L, 3L, 2L)).contains(2)); assertFailureKeys( e, "expected to contain", "an instance of", "but did not", "though it did contain", "full contents"); assertFailureValue(e, "expected to contain", "2"); assertFailureValue(e, "an instance of", "java.lang.Integer"); assertFailureValue(e, "though it did contain", "[2 [2 copies]] (java.lang.Long)"); assertFailureValue(e, "full contents", "[1, 2, 3, 2]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsFailsWithSameToString
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsFailsWithSameToStringAndNull() { AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList(1, "null")).contains(null)); assertFailureValue(e, "an instance of", "null type"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsFailsWithSameToStringAndNull
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsFailure() { AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList(1, 2, 3)).contains(5)); assertFailureKeys(e, "expected to contain", "but was"); assertFailureValue(e, "expected to contain", "5"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsFailure
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableDoesNotContain() { assertThat(asList(1, null, 3)).doesNotContain(5); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableDoesNotContain
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableDoesNotContainNull() { assertThat(asList(1, 2, 3)).doesNotContain(null); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableDoesNotContainNull
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableDoesNotContainFailure() { AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList(1, 2, 3)).doesNotContain(2)); assertFailureKeys(e, "expected not to contain", "but was"); assertFailureValue(e, "expected not to contain", "2"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableDoesNotContainFailure
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void doesNotContainDuplicates() { assertThat(asList(1, 2, 3)).containsNoDuplicates(); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
doesNotContainDuplicates
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void doesNotContainDuplicatesMixedTypes() { assertThat(asList(1, 2, 2L, 3)).containsNoDuplicates(); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
doesNotContainDuplicatesMixedTypes
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void doesNotContainDuplicatesFailure() { AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList(1, 2, 2, 3)).containsNoDuplicates()); assertFailureKeys(e, "expected not to contain duplicates", "but contained", "full contents"); assertFailureValue(e, "but contained", "[2 x 2]"); assertFailureValue(e, "full contents", "[1, 2, 2, 3]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
doesNotContainDuplicatesFailure
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAnyOf() { assertThat(asList(1, 2, 3)).containsAnyOf(1, 5); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAnyOf
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAnyOfWithNull() { assertThat(asList(1, null, 3)).containsAnyOf(null, 5); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAnyOfWithNull
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAnyOfWithNullInThirdAndFinalPosition() { assertThat(asList(1, null, 3)).containsAnyOf(4, 5, (Integer) null); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAnyOfWithNullInThirdAndFinalPosition
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAnyOfFailure() { AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList(1, 2, 3)).containsAnyOf(5, 6, 0)); assertFailureKeys(e, "expected to contain any of", "but was"); assertFailureValue(e, "expected to contain any of", "[5, 6, 0]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAnyOfFailure
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAnyOfFailsWithSameToStringAndHomogeneousList() { AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList(1L, 2L, 3L)).containsAnyOf(2, 3)); assertFailureKeys( e, "expected to contain any of", "but did not", "though it did contain", "full contents"); assertFailureValue(e, "expected to contain any of", "[2, 3] (java.lang.Integer)"); assertFailureValue(e, "though it did contain", "[2, 3] (java.lang.Long)"); assertFailureValue(e, "full contents", "[1, 2, 3]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAnyOfFailsWithSameToStringAndHomogeneousList
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAnyOfFailsWithSameToStringAndHomogeneousListWithDuplicates() { AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList(3L, 3L)).containsAnyOf(2, 3, 3)); assertFailureKeys( e, "expected to contain any of", "but did not", "though it did contain", "full contents"); assertFailureValue(e, "expected to contain any of", "[2, 3 [2 copies]] (java.lang.Integer)"); assertFailureValue(e, "though it did contain", "[3 [2 copies]] (java.lang.Long)"); assertFailureValue(e, "full contents", "[3, 3]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAnyOfFailsWithSameToStringAndHomogeneousListWithDuplicates
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAnyOfFailsWithSameToStringAndNullInSubject() { AssertionError e = expectFailure( whenTesting -> whenTesting.that(asList(null, "abc")).containsAnyOf("def", "null")); assertFailureKeys( e, "expected to contain any of", "but did not", "though it did contain", "full contents"); assertFailureValue(e, "expected to contain any of", "[def, null] (java.lang.String)"); assertFailureValue(e, "though it did contain", "[null (null type)]"); assertFailureValue(e, "full contents", "[null, abc]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAnyOfFailsWithSameToStringAndNullInSubject
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAnyOfFailsWithSameToStringAndNullInExpectation() { AssertionError e = expectFailure( whenTesting -> whenTesting.that(asList("null", "abc")).containsAnyOf("def", null)); assertFailureKeys( e, "expected to contain any of", "but did not", "though it did contain", "full contents"); assertFailureValue( e, "expected to contain any of", "[def (java.lang.String), null (null type)]"); assertFailureValue(e, "though it did contain", "[null] (java.lang.String)"); assertFailureValue(e, "full contents", "[null, abc]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAnyOfFailsWithSameToStringAndNullInExpectation
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAnyOfWithOneShotIterable() { List<Object> contents = asList(2, 1, "b"); Iterable<Object> oneShot = new OneShotIterable<>(contents.iterator(), "OneShotIterable"); assertThat(oneShot).containsAnyOf(3, "a", 7, "b", 0); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAnyOfWithOneShotIterable
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAnyInIterable() { assertThat(asList(1, 2, 3)).containsAnyIn(asList(1, 10, 100)); AssertionError e = expectFailure( whenTesting -> whenTesting.that(asList(1, 2, 3)).containsAnyIn(asList(5, 6, 0))); assertFailureKeys(e, "expected to contain any of", "but was"); assertFailureValue(e, "expected to contain any of", "[5, 6, 0]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAnyInIterable
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAnyInArray() { assertThat(asList(1, 2, 3)).containsAnyIn(new Integer[] {1, 10, 100}); AssertionError e = expectFailure( whenTesting -> whenTesting.that(asList(1, 2, 3)).containsAnyIn(new Integer[] {5, 6, 0})); assertFailureKeys(e, "expected to contain any of", "but was"); assertFailureValue(e, "expected to contain any of", "[5, 6, 0]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAnyInArray
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeast() { assertThat(asList(1, 2, 3)).containsAtLeast(1, 2); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeast
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastWithMany() { assertThat(asList(1, 2, 3)).containsAtLeast(1, 2); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastWithMany
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastWithDuplicates() { assertThat(asList(1, 2, 2, 2, 3)).containsAtLeast(2, 2); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastWithDuplicates
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastWithNull() { assertThat(asList(1, null, 3)).containsAtLeast(3, (Integer) null); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastWithNull
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastWithNullAtThirdAndFinalPosition() { assertThat(asList(1, null, 3)).containsAtLeast(1, 3, (Object) null); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastWithNullAtThirdAndFinalPosition
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastElementsInOutOfOrderDoesNotStringify() { CountsToStringCalls o = new CountsToStringCalls(); List<Object> actual = asList(o, 1); List<Object> expected = asList(1, o); assertThat(actual).containsAtLeastElementsIn(expected); assertThat(o.calls).isEqualTo(0); expectFailure( whenTesting -> whenTesting.that(actual).containsAtLeastElementsIn(expected).inOrder()); assertThat(o.calls).isGreaterThan(0); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastElementsInOutOfOrderDoesNotStringify
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastFailure() { AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList(1, 2, 3)).containsAtLeast(1, 2, 4)); assertFailureKeys(e, "missing (1)", "---", "expected to contain at least", "but was"); assertFailureValue(e, "missing (1)", "4"); assertFailureValue(e, "expected to contain at least", "[1, 2, 4]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastFailure
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastWithExtras() { AssertionError e = expectFailure( whenTesting -> whenTesting.that(asList("y", "x")).containsAtLeast("x", "y", "z")); assertFailureValue(e, "missing (1)", "z"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastWithExtras
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastWithExtraCopiesOfOutOfOrder() { AssertionError e = expectFailure( whenTesting -> whenTesting.that(asList("y", "x")).containsAtLeast("x", "y", "y")); assertFailureValue(e, "missing (1)", "y"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastWithExtraCopiesOfOutOfOrder
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastWithDuplicatesFailure() { AssertionError e = expectFailure( whenTesting -> whenTesting.that(asList(1, 2, 3)).containsAtLeast(1, 2, 2, 2, 3, 4)); assertFailureValue(e, "missing (3)", "2 [2 copies], 4"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastWithDuplicatesFailure
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastWithDuplicateMissingElements() { AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList(1, 2)).containsAtLeast(4, 4, 4)); assertFailureValue(e, "missing (3)", "4 [3 copies]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastWithDuplicateMissingElements
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastWithNullFailure() { AssertionError e = expectFailure( whenTesting -> whenTesting.that(asList(1, null, 3)).containsAtLeast(1, null, null, 3)); assertFailureValue(e, "missing (1)", "null"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastWithNullFailure
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastFailsWithSameToStringAndHomogeneousList() { AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList(1L, 2L)).containsAtLeast(1, 2)); assertFailureValue(e, "missing (2)", "1, 2 (java.lang.Integer)"); assertFailureValue(e, "though it did contain (2)", "1, 2 (java.lang.Long)"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastFailsWithSameToStringAndHomogeneousList
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastFailsWithSameToStringAndHomogeneousListWithDuplicates() { AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList(1L, 2L, 2L)).containsAtLeast(1, 1, 2)); assertFailureValue(e, "missing (3)", "1 [2 copies], 2 (java.lang.Integer)"); assertFailureValue(e, "though it did contain (3)", "1, 2 [2 copies] (java.lang.Long)"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastFailsWithSameToStringAndHomogeneousListWithDuplicates
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastFailsWithSameToStringAndHomogeneousListWithNull() { AssertionError e = expectFailure( whenTesting -> whenTesting.that(asList("null", "abc")).containsAtLeast("abc", null)); assertFailureValue(e, "missing (1)", "null (null type)"); assertFailureValue(e, "though it did contain (1)", "null (java.lang.String)"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastFailsWithSameToStringAndHomogeneousListWithNull
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastFailsWithSameToStringAndHeterogeneousListWithDuplicates() { AssertionError e = expectFailure( whenTesting -> whenTesting.that(asList(1, 2, 2L, 3L, 3L)).containsAtLeast(2L, 2L, 3, 3)); assertFailureValue(e, "missing (3)", "2 (java.lang.Long), 3 (java.lang.Integer) [2 copies]"); assertFailureValue( e, "though it did contain (3)", "2 (java.lang.Integer), 3 (java.lang.Long) [2 copies]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastFailsWithSameToStringAndHeterogeneousListWithDuplicates
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastFailsWithEmptyString() { AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList("a", null)).containsAtLeast("", null)); assertFailureKeys(e, "missing (1)", "---", "expected to contain at least", "but was"); assertFailureValue(e, "missing (1)", ""); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastFailsWithEmptyString
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastInOrder() { assertThat(asList(3, 2, 5)).containsAtLeast(3, 2, 5).inOrder(); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastInOrder
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test 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(); assertThat(asList("x", "y", "y", "z")).containsAtLeast("x", "y", "z").inOrder(); assertThat(asList("x", "x", "y", "z")).containsAtLeast("x", "y", "z").inOrder(); assertThat(asList("z", "x", "y", "z")).containsAtLeast("x", "y", "z").inOrder(); assertThat(asList("x", "x", "y", "z", "x")).containsAtLeast("x", "y", "z", "x").inOrder(); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastInOrderWithGaps
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastInOrderWithNull() { assertThat(asList(3, null, 5)).containsAtLeast(3, null, 5).inOrder(); assertThat(asList(3, null, 7, 5)).containsAtLeast(3, null, 5).inOrder(); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastInOrderWithNull
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastInOrderWithFailure() { AssertionError e = expectFailure( whenTesting -> whenTesting.that(asList(1, null, 3)).containsAtLeast(null, 1, 3).inOrder()); assertFailureKeys( e, "required elements were all found, but order was wrong", "expected order for required elements", "but was"); assertFailureValue(e, "expected order for required elements", "[null, 1, 3]"); assertFailureValue(e, "but was", "[1, null, 3]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastInOrderWithFailure
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastInOrderWithFailureWithActualOrder() { AssertionError e = expectFailure( whenTesting -> whenTesting.that(asList(1, 2, null, 3, 4)).containsAtLeast(null, 1, 3).inOrder()); assertFailureKeys( e, "required elements were all found, but order was wrong", "expected order for required elements", "but order was", "full contents"); assertFailureValue(e, "expected order for required elements", "[null, 1, 3]"); assertFailureValue(e, "but order was", "[1, null, 3]"); assertFailureValue(e, "full contents", "[1, 2, null, 3, 4]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastInOrderWithFailureWithActualOrder
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastInOrderWithOneShotIterable() { List<Object> contents = asList(2, 1, null, 4, "a", 3, "b"); Iterable<Object> oneShot = new OneShotIterable<>(contents.iterator(), contents.toString()); assertThat(oneShot).containsAtLeast(1, null, 3).inOrder(); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastInOrderWithOneShotIterable
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastInOrderWithOneShotIterableWrongOrder() { List<Object> contents = asList(2, 1, null, 4, "a", 3, "b"); Iterable<Object> oneShot = new OneShotIterable<>(contents.iterator(), "BadIterable"); AssertionError e = expectFailure( whenTesting -> whenTesting.that(oneShot).containsAtLeast(1, 3, (Object) null).inOrder()); assertFailureKeys( e, "required elements were all found, but order was wrong", "expected order for required elements", "but was"); assertFailureValue(e, "expected order for required elements", "[1, 3, null]"); assertFailureValue(e, "but was", "BadIterable"); // TODO(b/231966021): Output its elements. }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastInOrderWithOneShotIterableWrongOrder
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Override public Iterator<E> iterator() { return iterator; }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterator
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Override public String toString() { return toString; }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
toString
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastInOrderWrongOrderAndMissing() { expectFailure(whenTesting -> whenTesting.that(asList(1, 2)).containsAtLeast(2, 1, 3).inOrder()); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastInOrderWrongOrderAndMissing
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test @SuppressWarnings("ContainsAllElementsInWithVarArgsToContainsAtLeast") public void iterableContainsAtLeastElementsInIterable() { assertThat(asList(1, 2, 3)).containsAtLeastElementsIn(asList(1, 2)); AssertionError e = expectFailure( whenTesting -> whenTesting.that(asList(1, 2, 3)).containsAtLeastElementsIn(asList(1, 2, 4))); assertFailureKeys(e, "missing (1)", "---", "expected to contain at least", "but was"); assertFailureValue(e, "missing (1)", "4"); assertFailureValue(e, "expected to contain at least", "[1, 2, 4]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastElementsInIterable
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test @SuppressWarnings("ContainsAllElementsInWithVarArgsToContainsAtLeast") public void iterableContainsAtLeastElementsInCanUseFactPerElement() { AssertionError e = expectFailure( whenTesting -> whenTesting .that(asList("abc")) .containsAtLeastElementsIn(asList("123\n456", "789"))); assertFailureKeys( e, "missing (2)", "#1", "#2", "---", "expected to contain at least", "but was"); assertFailureValue(e, "#1", "123\n456"); assertFailureValue(e, "#2", "789"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastElementsInCanUseFactPerElement
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsAtLeastElementsInArray() { assertThat(asList(1, 2, 3)).containsAtLeastElementsIn(new Integer[] {1, 2}); AssertionError e = expectFailure( whenTesting -> whenTesting .that(asList(1, 2, 3)) .containsAtLeastElementsIn(new Integer[] {1, 2, 4})); assertFailureKeys(e, "missing (1)", "---", "expected to contain at least", "but was"); assertFailureValue(e, "missing (1)", "4"); assertFailureValue(e, "expected to contain at least", "[1, 2, 4]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsAtLeastElementsInArray
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsNoneOf() { assertThat(asList(1, 2, 3)).containsNoneOf(4, 5, 6); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsNoneOf
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsNoneOfFailure() { AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList(1, 2, 3)).containsNoneOf(1, 2, 4)); assertFailureKeys(e, "expected not to contain any of", "but contained", "full contents"); assertFailureValue(e, "expected not to contain any of", "[1, 2, 4]"); assertFailureValue(e, "but contained", "[1, 2]"); assertFailureValue(e, "full contents", "[1, 2, 3]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsNoneOfFailure
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsNoneOfFailureWithDuplicateInSubject() { AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList(1, 2, 2, 3)).containsNoneOf(1, 2, 4)); assertFailureValue(e, "but contained", "[1, 2]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsNoneOfFailureWithDuplicateInSubject
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsNoneOfFailureWithDuplicateInExpected() { AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList(1, 2, 3)).containsNoneOf(1, 2, 2, 4)); assertFailureValue(e, "but contained", "[1, 2]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsNoneOfFailureWithDuplicateInExpected
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsNoneOfFailureWithEmptyString() { AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList("")).containsNoneOf("", null)); assertFailureKeys(e, "expected not to contain any of", "but contained", "full contents"); assertFailureValue(e, "expected not to contain any of", "[\"\" (empty String), null]"); assertFailureValue(e, "but contained", "[\"\" (empty String)]"); assertFailureValue(e, "full contents", "[]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsNoneOfFailureWithEmptyString
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test @SuppressWarnings("ContainsNoneInWithVarArgsToContainsNoneOf") public void iterableContainsNoneInIterable() { assertThat(asList(1, 2, 3)).containsNoneIn(asList(4, 5, 6)); AssertionError e = expectFailure( whenTesting -> whenTesting.that(asList(1, 2, 3)).containsNoneIn(asList(1, 2, 4))); assertFailureKeys(e, "expected not to contain any of", "but contained", "full contents"); assertFailureValue(e, "expected not to contain any of", "[1, 2, 4]"); assertFailureValue(e, "but contained", "[1, 2]"); assertFailureValue(e, "full contents", "[1, 2, 3]"); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsNoneInIterable
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsNoneInArray() { assertThat(asList(1, 2, 3)).containsNoneIn(new Integer[] {4, 5, 6}); expectFailure( whenTesting -> whenTesting.that(asList(1, 2, 3)).containsNoneIn(new Integer[] {1, 2, 4})); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsNoneInArray
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsExactlyArray() { String[] stringArray = {"a", "b"}; ImmutableList<String[]> iterable = ImmutableList.of(stringArray); // This test fails w/o the explicit cast assertThat(iterable).containsExactly((Object) stringArray); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsExactlyArray
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test // We tell people to call containsExactlyElementsIn, but we still test containsExactly. @SuppressWarnings("ContainsExactlyVariadic") public void arrayContainsExactly() { ImmutableList<String> iterable = ImmutableList.of("a", "b"); String[] array = {"a", "b"}; assertThat(iterable).containsExactly((Object[]) array); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
arrayContainsExactly
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsExactlyWithMany() { assertThat(asList(1, 2, 3)).containsExactly(1, 2, 3); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsExactlyWithMany
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0
@Test public void iterableContainsExactlyOutOfOrder() { assertThat(asList(1, 2, 3, 4)).containsExactly(3, 1, 4, 2); }
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which are tested in {@link IterableSubjectCorrespondenceTest}. @author David Saff @author Christian Gruber ([email protected])
iterableContainsExactlyOutOfOrder
java
google/truth
core/src/test/java/com/google/common/truth/IterableSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/IterableSubjectTest.java
Apache-2.0