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 iterableContainsExactlyWithDuplicates() {
assertThat(asList(1, 2, 2, 2, 3)).containsExactly(1, 2, 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 (cgruber@israfil.net)
|
iterableContainsExactlyWithDuplicates
|
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 iterableContainsExactlyWithDuplicatesOutOfOrder() {
assertThat(asList(1, 2, 2, 2, 3)).containsExactly(2, 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 (cgruber@israfil.net)
|
iterableContainsExactlyWithDuplicatesOutOfOrder
|
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 iterableContainsExactlyWithOnlyNullPassedAsNullArray() {
// Truth is tolerant of this erroneous varargs call.
Iterable<Object> actual = asList((Object) null);
assertThat(actual).containsExactly((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 (cgruber@israfil.net)
|
iterableContainsExactlyWithOnlyNullPassedAsNullArray
|
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 iterableContainsExactlyWithOnlyNull() {
Iterable<Object> actual = asList((Object) null);
assertThat(actual).containsExactly((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 (cgruber@israfil.net)
|
iterableContainsExactlyWithOnlyNull
|
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 iterableContainsExactlyWithNullSecond() {
assertThat(asList(1, null)).containsExactly(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 (cgruber@israfil.net)
|
iterableContainsExactlyWithNullSecond
|
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 iterableContainsExactlyWithNullThird() {
assertThat(asList(1, 2, null)).containsExactly(1, 2, null);
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyWithNullThird
|
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 iterableContainsExactlyWithNull() {
assertThat(asList(1, null, 3)).containsExactly(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 (cgruber@israfil.net)
|
iterableContainsExactlyWithNull
|
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 iterableContainsExactlyWithNullOutOfOrder() {
assertThat(asList(1, null, 3)).containsExactly(1, 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 (cgruber@israfil.net)
|
iterableContainsExactlyWithNullOutOfOrder
|
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 iterableContainsExactlyOutOfOrderDoesNotStringify() {
CountsToStringCalls o = new CountsToStringCalls();
List<Object> actual = asList(o, 1);
List<Object> expected = asList(1, o);
assertThat(actual).containsExactlyElementsIn(expected);
assertThat(o.calls).isEqualTo(0);
expectFailure(
whenTesting -> whenTesting.that(actual).containsExactlyElementsIn(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 (cgruber@israfil.net)
|
iterableContainsExactlyOutOfOrderDoesNotStringify
|
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 iterableContainsExactlyWithEmptyString() {
AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList()).containsExactly(""));
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 (cgruber@israfil.net)
|
iterableContainsExactlyWithEmptyString
|
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 iterableContainsExactlyWithEmptyStringAndUnexpectedItem() {
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(asList("a", null)).containsExactly(""));
assertFailureKeys(e, "missing (1)", "unexpected (2)", "---", "expected", "but was");
assertFailureValue(e, "missing (1)", "");
assertFailureValue(e, "unexpected (2)", "a, null");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyWithEmptyStringAndUnexpectedItem
|
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 iterableContainsExactlyWithEmptyStringAndMissingItem() {
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(asList("")).containsExactly("a", null));
assertFailureValue(e, "missing (2)", "a, null");
assertFailureValue(e, "unexpected (1)", "");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyWithEmptyStringAndMissingItem
|
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 iterableContainsExactlyWithEmptyStringAmongMissingItems() {
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(asList("a")).containsExactly("", "b"));
assertFailureKeys(
e, "missing (2)", "#1", "#2", "", "unexpected (1)", "#1", "---", "expected", "but was");
assertFailureValueIndexed(e, "#1", 0, "");
assertFailureValueIndexed(e, "#2", 0, "b");
assertFailureValueIndexed(e, "#1", 1, "a");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyWithEmptyStringAmongMissingItems
|
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 iterableContainsExactlySingleElement() {
assertThat(asList(1)).containsExactly(1);
AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList(1)).containsExactly(2));
assertFailureKeys(e, "value of", "expected", "but was");
assertFailureValue(e, "value of", "iterable.onlyElement()");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlySingleElement
|
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 iterableContainsExactlySingleElementNoEqualsMagic() {
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(asList(1)).containsExactly(1L));
assertFailureValueIndexed(e, "an instance of", 0, "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 (cgruber@israfil.net)
|
iterableContainsExactlySingleElementNoEqualsMagic
|
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("ContainsExactlyElementsInWithVarArgsToExactly")
public void iterableContainsExactlyWithElementsThatThrowWhenYouCallHashCode() {
HashCodeThrower one = new HashCodeThrower();
HashCodeThrower two = new HashCodeThrower();
assertThat(asList(one, two)).containsExactly(two, one);
assertThat(asList(one, two)).containsExactly(one, two).inOrder();
assertThat(asList(one, two)).containsExactlyElementsIn(asList(two, one));
assertThat(asList(one, two)).containsExactlyElementsIn(asList(one, two)).inOrder();
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyWithElementsThatThrowWhenYouCallHashCode
|
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 iterableContainsExactlyWithElementsThatThrowWhenYouCallHashCodeFailureTooMany() {
HashCodeThrower one = new HashCodeThrower();
HashCodeThrower two = new HashCodeThrower();
expectFailure(whenTesting -> whenTesting.that(asList(one, two)).containsExactly(one));
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyWithElementsThatThrowWhenYouCallHashCodeFailureTooMany
|
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 iterableContainsExactlyWithElementsThatThrowWhenYouCallHashCodeOneMismatch() {
HashCodeThrower one = new HashCodeThrower();
HashCodeThrower two = new HashCodeThrower();
expectFailure(whenTesting -> whenTesting.that(asList(one, one)).containsExactly(one, two));
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyWithElementsThatThrowWhenYouCallHashCodeOneMismatch
|
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 boolean equals(Object other) {
return this == other;
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
equals
|
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 int hashCode() {
throw new UnsupportedOperationException();
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
hashCode
|
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 "HCT";
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
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
@SuppressWarnings({"ContainsExactlyNone", "TruthSelfEquals"})
public void iterableContainsExactlyElementsInInOrderPassesWithEmptyExpectedAndActual() {
assertThat(ImmutableList.of()).containsExactlyElementsIn(ImmutableList.of()).inOrder();
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyElementsInInOrderPassesWithEmptyExpectedAndActual
|
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("ContainsExactlyNone")
public void iterableContainsExactlyElementsInWithEmptyExpected() {
AssertionError e =
expectFailure(
whenTesting ->
whenTesting.that(asList("foo")).containsExactlyElementsIn(ImmutableList.of()));
assertFailureKeys(e, "expected to be empty", "but was");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyElementsInWithEmptyExpected
|
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("ContainsExactlyElementsInWithVarArgsToExactly")
public void iterableContainsExactlyElementsInErrorMessageIsInOrder() {
AssertionError e =
expectFailure(
whenTesting ->
whenTesting
.that(asList("foo OR bar"))
.containsExactlyElementsIn(asList("foo", "bar")));
assertFailureValue(e, "missing (2)", "foo, bar");
assertFailureValue(e, "unexpected (1)", "foo OR bar");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyElementsInErrorMessageIsInOrder
|
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 iterableContainsExactlyMissingItemFailure() {
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(asList(1, 2)).containsExactly(1, 2, 4));
assertFailureValue(e, "missing (1)", "4");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyMissingItemFailure
|
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 iterableContainsExactlyUnexpectedItemFailure() {
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(asList(1, 2, 3)).containsExactly(1, 2));
assertFailureValue(e, "unexpected (1)", "3");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyUnexpectedItemFailure
|
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 iterableContainsExactlyWithDuplicatesNotEnoughItemsFailure() {
AssertionError e =
expectFailure(
whenTesting -> whenTesting.that(asList(1, 2, 3)).containsExactly(1, 2, 2, 2, 3));
assertFailureValue(e, "missing (2)", "2 [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 (cgruber@israfil.net)
|
iterableContainsExactlyWithDuplicatesNotEnoughItemsFailure
|
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 iterableContainsExactlyWithDuplicatesMissingItemFailure() {
AssertionError e =
expectFailure(
whenTesting -> whenTesting.that(asList(1, 2, 3)).containsExactly(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 (cgruber@israfil.net)
|
iterableContainsExactlyWithDuplicatesMissingItemFailure
|
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 iterableContainsExactlyWithDuplicatesMissingItemsWithNewlineFailure() {
AssertionError e =
expectFailure(
whenTesting ->
whenTesting
.that(asList("a", "b", "foo\nbar"))
.containsExactly("a", "b", "foo\nbar", "foo\nbar", "foo\nbar"));
assertFailureKeys(e, "missing (2)", "#1 [2 copies]", "---", "expected", "but was");
assertFailureValue(e, "#1 [2 copies]", "foo\nbar");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyWithDuplicatesMissingItemsWithNewlineFailure
|
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 iterableContainsExactlyWithDuplicatesMissingAndExtraItemsWithNewlineFailure() {
AssertionError e =
expectFailure(
whenTesting ->
whenTesting.that(asList("a\nb", "a\nb")).containsExactly("foo\nbar", "foo\nbar"));
assertFailureKeys(
e,
"missing (2)",
"#1 [2 copies]",
"",
"unexpected (2)",
"#1 [2 copies]",
"---",
"expected",
"but was");
assertFailureValueIndexed(e, "#1 [2 copies]", 0, "foo\nbar");
assertFailureValueIndexed(e, "#1 [2 copies]", 1, "a\nb");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyWithDuplicatesMissingAndExtraItemsWithNewlineFailure
|
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 iterableContainsExactlyWithDuplicatesUnexpectedItemFailure() {
AssertionError e =
expectFailure(
whenTesting -> whenTesting.that(asList(1, 2, 2, 2, 2, 3)).containsExactly(1, 2, 2, 3));
assertFailureValue(e, "unexpected (2)", "2 [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 (cgruber@israfil.net)
|
iterableContainsExactlyWithDuplicatesUnexpectedItemFailure
|
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 iterableContainsExactlyWithDuplicateMissingElements() {
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(asList()).containsExactly(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 (cgruber@israfil.net)
|
iterableContainsExactlyWithDuplicateMissingElements
|
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 iterableContainsExactlyWithNullFailure() {
AssertionError e =
expectFailure(
whenTesting -> whenTesting.that(asList(1, null, 3)).containsExactly(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 (cgruber@israfil.net)
|
iterableContainsExactlyWithNullFailure
|
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 iterableContainsExactlyWithMissingAndExtraElements() {
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(asList(1, 2, 3)).containsExactly(1, 2, 4));
assertFailureValue(e, "missing (1)", "4");
assertFailureValue(e, "unexpected (1)", "3");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyWithMissingAndExtraElements
|
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 iterableContainsExactlyWithDuplicateMissingAndExtraElements() {
AssertionError e =
expectFailure(
whenTesting -> whenTesting.that(asList(1, 2, 3, 3)).containsExactly(1, 2, 4, 4));
assertFailureValue(e, "missing (2)", "4 [2 copies]");
assertFailureValue(e, "unexpected (2)", "3 [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 (cgruber@israfil.net)
|
iterableContainsExactlyWithDuplicateMissingAndExtraElements
|
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 iterableContainsExactlyWithCommaSeparatedVsIndividual() {
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(asList("a, b")).containsExactly("a", "b"));
assertFailureKeys(
e, "missing (2)", "#1", "#2", "", "unexpected (1)", "#1", "---", "expected", "but was");
assertFailureValueIndexed(e, "#1", 0, "a");
assertFailureValueIndexed(e, "#2", 0, "b");
assertFailureValueIndexed(e, "#1", 1, "a, b");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyWithCommaSeparatedVsIndividual
|
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 iterableContainsExactlyFailsWithSameToStringAndHomogeneousList() {
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(asList(1L, 2L)).containsExactly(1, 2));
assertFailureValue(e, "missing (2)", "1, 2 (java.lang.Integer)");
assertFailureValue(e, "unexpected (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 (cgruber@israfil.net)
|
iterableContainsExactlyFailsWithSameToStringAndHomogeneousList
|
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 iterableContainsExactlyFailsWithSameToStringAndListWithNull() {
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(asList(1L, 2L)).containsExactly(null, 1, 2));
assertFailureValue(
e, "missing (3)", "null (null type), 1 (java.lang.Integer), 2 (java.lang.Integer)");
assertFailureValue(e, "unexpected (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 (cgruber@israfil.net)
|
iterableContainsExactlyFailsWithSameToStringAndListWithNull
|
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 iterableContainsExactlyFailsWithSameToStringAndHeterogeneousList() {
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(asList(1L, 2)).containsExactly(1, null, 2L));
assertFailureValue(
e, "missing (3)", "1 (java.lang.Integer), null (null type), 2 (java.lang.Long)");
assertFailureValue(e, "unexpected (2)", "1 (java.lang.Long), 2 (java.lang.Integer)");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyFailsWithSameToStringAndHeterogeneousList
|
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 iterableContainsExactlyFailsWithSameToStringAndHomogeneousListWithDuplicates() {
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(asList(1L, 2L)).containsExactly(1, 2, 2));
assertFailureValue(e, "missing (3)", "1, 2 [2 copies] (java.lang.Integer)");
assertFailureValue(e, "unexpected (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 (cgruber@israfil.net)
|
iterableContainsExactlyFailsWithSameToStringAndHomogeneousListWithDuplicates
|
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 iterableContainsExactlyFailsWithSameToStringAndHeterogeneousListWithDuplicates() {
AssertionError e =
expectFailure(
whenTesting -> whenTesting.that(asList(1L, 2)).containsExactly(1, null, null, 2L, 2L));
assertFailureValue(
e,
"missing (5)",
"1 (java.lang.Integer), null (null type) [2 copies], 2 (java.lang.Long) [2 copies]");
assertFailureValue(e, "unexpected (2)", "1 (java.lang.Long), 2 (java.lang.Integer)");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyFailsWithSameToStringAndHeterogeneousListWithDuplicates
|
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 iterableContainsExactlyWithOneIterableGivesWarning() {
AssertionError e =
expectFailure(
whenTesting ->
whenTesting.that(asList(1, 2, 3, 4)).containsExactly(asList(1, 2, 3, 4)));
assertThat(e).hasMessageThat().contains(CONTAINS_EXACTLY_ITERABLE_WARNING);
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyWithOneIterableGivesWarning
|
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("ContainsExactlyElementsInWithVarArgsToExactly")
public void iterableContainsExactlyElementsInWithOneIterableDoesNotGiveWarning() {
AssertionError e =
expectFailure(
whenTesting ->
whenTesting.that(asList(1, 2, 3, 4)).containsExactlyElementsIn(asList(1, 2, 3)));
assertFailureValue(e, "unexpected (1)", "4");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyElementsInWithOneIterableDoesNotGiveWarning
|
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 iterableContainsExactlyWithTwoIterableDoesNotGivesWarning() {
AssertionError e =
expectFailure(
whenTesting ->
whenTesting.that(asList(1, 2, 3, 4)).containsExactly(asList(1, 2), asList(3, 4)));
assertThat(e).hasMessageThat().doesNotContain(CONTAINS_EXACTLY_ITERABLE_WARNING);
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyWithTwoIterableDoesNotGivesWarning
|
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 iterableContainsExactlyWithOneNonIterableDoesNotGiveWarning() {
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(asList(1, 2, 3, 4)).containsExactly(1));
assertFailureValue(e, "unexpected (3)", "2, 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 (cgruber@israfil.net)
|
iterableContainsExactlyWithOneNonIterableDoesNotGiveWarning
|
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 iterableContainsExactlyInOrder() {
assertThat(asList(3, 2, 5)).containsExactly(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 (cgruber@israfil.net)
|
iterableContainsExactlyInOrder
|
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 iterableContainsExactlyInOrderWithNull() {
assertThat(asList(3, null, 5)).containsExactly(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 (cgruber@israfil.net)
|
iterableContainsExactlyInOrderWithNull
|
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 iterableContainsExactlyInOrderWithFailure() {
AssertionError e =
expectFailure(
whenTesting ->
whenTesting.that(asList(1, null, 3)).containsExactly(null, 1, 3).inOrder());
assertFailureKeys(e, "contents match, but order was wrong", "expected", "but was");
assertFailureValue(e, "expected", "[null, 1, 3]");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyInOrderWithFailure
|
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 iterableContainsExactlyInOrderWithOneShotIterable() {
Iterator<Object> iterator = asList((Object) 1, null, 3).iterator();
Iterable<Object> iterable = () -> iterator;
assertThat(iterable).containsExactly(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 (cgruber@israfil.net)
|
iterableContainsExactlyInOrderWithOneShotIterable
|
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 iterableContainsExactlyInOrderWithOneShotIterableWrongOrder() {
Iterator<Object> iterator = asList((Object) 1, null, 3).iterator();
Iterable<Object> iterable =
new Iterable<Object>() {
@Override
public Iterator<Object> iterator() {
return iterator;
}
@Override
public String toString() {
return "BadIterable";
}
};
AssertionError e =
expectFailure(
whenTesting -> whenTesting.that(iterable).containsExactly(1, 3, null).inOrder());
assertFailureKeys(e, "contents match, but order was wrong", "expected", "but was");
assertFailureValue(e, "expected", "[1, 3, null]");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyInOrderWithOneShotIterableWrongOrder
|
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<Object> 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 (cgruber@israfil.net)
|
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 "BadIterable";
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
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 iterableWithNoToStringOverride() {
Iterable<Integer> iterable = () -> Iterators.forArray(1, 2, 3);
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(iterable).containsExactly(1, 2).inOrder());
assertFailureValue(e, "but was", "[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 (cgruber@israfil.net)
|
iterableWithNoToStringOverride
|
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("ContainsExactlyElementsInWithVarArgsToExactly")
public void iterableContainsExactlyElementsInIterable() {
assertThat(asList(1, 2)).containsExactlyElementsIn(asList(1, 2));
AssertionError e =
expectFailure(
whenTesting ->
whenTesting.that(asList(1, 2)).containsExactlyElementsIn(asList(1, 2, 4)));
assertFailureValue(e, "missing (1)", "4");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyElementsInIterable
|
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 iterableContainsExactlyElementsInArray() {
assertThat(asList(1, 2)).containsExactlyElementsIn(new Integer[] {1, 2});
AssertionError e =
expectFailure(
whenTesting ->
whenTesting.that(asList(1, 2)).containsExactlyElementsIn(new Integer[] {1, 2, 4}));
assertFailureValue(e, "missing (1)", "4");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableContainsExactlyElementsInArray
|
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("UndefinedEquals") // Iterable equality isn't defined, but null equality is
public void nullEqualToNull() {
assertThat((Iterable<?>) null).isEqualTo(null);
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
nullEqualToNull
|
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 nullEqualToSomething() {
expectFailure(
whenTesting -> whenTesting.that((Iterable<?>) null).isEqualTo(ImmutableList.of()));
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
nullEqualToSomething
|
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 somethingEqualToNull() {
expectFailure(whenTesting -> whenTesting.that(ImmutableList.of()).isEqualTo(null));
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
somethingEqualToNull
|
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 somethingEqualToSomething() {
AssertionError e =
expectFailure(
whenTesting -> whenTesting.that(ImmutableList.of()).isEqualTo(ImmutableList.of("a")));
// isEqualTo uses the containsExactly style of message:
assertFailureValue(e, "missing (1)", "a");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
somethingEqualToSomething
|
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 isEqualToNotConsistentWithEquals() {
TreeSet<String> actual = new TreeSet<>(CASE_INSENSITIVE_ORDER);
TreeSet<String> expected = new TreeSet<>(CASE_INSENSITIVE_ORDER);
actual.add("one");
expected.add("ONE");
/*
* Our contract doesn't guarantee that the following test will pass. It *currently* does,
* though, and if we change that behavior, we want this test to let us know.
*/
assertThat(actual).isEqualTo(expected);
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
isEqualToNotConsistentWithEquals
|
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 isEqualToNotConsistentWithEquals_failure() {
TreeSet<String> actual = new TreeSet<>(CASE_INSENSITIVE_ORDER);
TreeSet<String> expected = new TreeSet<>(CASE_INSENSITIVE_ORDER);
actual.add("one");
expected.add("ONE");
actual.add("two");
expectFailure(whenTesting -> whenTesting.that(actual).isEqualTo(expected));
// The exact message generated is unspecified.
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
isEqualToNotConsistentWithEquals_failure
|
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 iterableIsEmpty() {
assertThat(asList()).isEmpty();
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableIsEmpty
|
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 iterableIsEmptyWithFailure() {
AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList(1, null, 3)).isEmpty());
assertFailureKeys(e, "expected to be empty", "but was");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableIsEmptyWithFailure
|
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 iterableIsNotEmpty() {
assertThat(asList("foo")).isNotEmpty();
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableIsNotEmpty
|
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 iterableIsNotEmptyWithFailure() {
AssertionError e = expectFailure(whenTesting -> whenTesting.that(asList()).isNotEmpty());
assertFailureKeys(e, "expected not to be empty");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableIsNotEmptyWithFailure
|
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 iterableIsInStrictOrder() {
assertThat(asList()).isInStrictOrder();
assertThat(asList(1)).isInStrictOrder();
assertThat(asList(1, 2, 3, 4)).isInStrictOrder();
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableIsInStrictOrder
|
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 isInStrictOrderFailure() {
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(asList(1, 2, 2, 4)).isInStrictOrder());
assertFailureKeys(
e, "expected to be in strict order", "but contained", "followed by", "full contents");
assertFailureValue(e, "but contained", "2");
assertFailureValue(e, "followed by", "2");
assertFailureValue(e, "full contents", "[1, 2, 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 (cgruber@israfil.net)
|
isInStrictOrderFailure
|
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 isInStrictOrderWithNonComparableElementsFailure() {
assertThrows(
ClassCastException.class,
() -> assertThat(asList((Object) 1, "2", 3, "4")).isInStrictOrder());
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
isInStrictOrderWithNonComparableElementsFailure
|
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 iterableIsInOrder() {
assertThat(asList()).isInOrder();
assertThat(asList(1)).isInOrder();
assertThat(asList(1, 1, 2, 3, 3, 3, 4)).isInOrder();
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableIsInOrder
|
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 isInOrderFailure() {
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(asList(1, 3, 2, 4)).isInOrder());
assertFailureKeys(
e, "expected to be in order", "but contained", "followed by", "full contents");
assertFailureValue(e, "but contained", "3");
assertFailureValue(e, "followed by", "2");
assertFailureValue(e, "full contents", "[1, 3, 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 (cgruber@israfil.net)
|
isInOrderFailure
|
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 isInOrderMultipleFailures() {
expectFailure(whenTesting -> whenTesting.that(asList(1, 3, 2, 4, 0)).isInOrder());
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
isInOrderMultipleFailures
|
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 isInOrderWithNonComparableElementsFailure() {
assertThrows(
ClassCastException.class, () -> assertThat(asList((Object) 1, "2", 2, "3")).isInOrder());
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
isInOrderWithNonComparableElementsFailure
|
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 iterableIsInStrictOrderWithComparator() {
Iterable<String> emptyStrings = asList();
assertThat(emptyStrings).isInStrictOrder(COMPARE_AS_DECIMAL);
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);
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableIsInStrictOrderWithComparator
|
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 iterableIsInStrictOrderWithComparatorFailure() {
AssertionError e =
expectFailure(
whenTesting ->
whenTesting.that(asList("1", "2", "2", "10")).isInStrictOrder(COMPARE_AS_DECIMAL));
assertFailureKeys(
e, "expected to be in strict order", "but contained", "followed by", "full contents");
assertFailureValue(e, "but contained", "2");
assertFailureValue(e, "followed by", "2");
assertFailureValue(e, "full contents", "[1, 2, 2, 10]");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableIsInStrictOrderWithComparatorFailure
|
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 iterableIsInOrderWithComparator() {
Iterable<String> emptyStrings = asList();
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);
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableIsInOrderWithComparator
|
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 iterableIsInOrderWithComparatorFailure() {
AssertionError e =
expectFailure(
whenTesting ->
whenTesting.that(asList("1", "10", "2", "20")).isInOrder(COMPARE_AS_DECIMAL));
assertFailureKeys(
e, "expected to be in order", "but contained", "followed by", "full contents");
assertFailureValue(e, "but contained", "10");
assertFailureValue(e, "followed by", "2");
assertFailureValue(e, "full contents", "[1, 10, 2, 20]");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableIsInOrderWithComparatorFailure
|
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 iterableOrderedByBaseClassComparator() {
Iterable<Bar> targetList = asList(new Bar(1), new Bar(2), new Bar(3));
assertThat(targetList).isInOrder(FOO_COMPARATOR);
assertThat(targetList).isInStrictOrder(FOO_COMPARATOR);
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
iterableOrderedByBaseClassComparator
|
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 isIn() {
ImmutableList<String> actual = ImmutableList.of("a");
ImmutableList<String> expectedA = ImmutableList.of("a");
ImmutableList<String> expectedB = ImmutableList.of("b");
ImmutableList<ImmutableList<String>> expected = ImmutableList.of(expectedA, expectedB);
assertThat(actual).isIn(expected);
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
isIn
|
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("deprecation") // test of a mistaken call
public void isNotIn() {
ImmutableList<String> actual = ImmutableList.of("a");
assertThat(actual).isNotIn(ImmutableList.of(ImmutableList.of("b"), ImmutableList.of("c")));
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(actual).isNotIn(ImmutableList.of("a", "b")));
assertThat(e)
.hasMessageThat()
.isEqualTo(
"The actual value is an Iterable, and you've written a test that compares it to some "
+ "objects that are not Iterables. Did you instead mean to check whether its "
+ "*contents* match any of the *contents* of the given values? If so, call "
+ "containsNoneOf(...)/containsNoneIn(...) instead. Non-iterables: [a, b]");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
isNotIn
|
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 isAnyOf() {
ImmutableList<String> actual = ImmutableList.of("a");
ImmutableList<String> expectedA = ImmutableList.of("a");
ImmutableList<String> expectedB = ImmutableList.of("b");
assertThat(actual).isAnyOf(expectedA, expectedB);
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
isAnyOf
|
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({"IncompatibleArgumentType", "deprecation"}) // test of a mistaken call
public void isNoneOf() {
ImmutableList<String> actual = ImmutableList.of("a");
assertThat(actual).isNoneOf(ImmutableList.of("b"), ImmutableList.of("c"));
AssertionError e = expectFailure(whenTesting -> whenTesting.that(actual).isNoneOf("a", "b"));
assertThat(e)
.hasMessageThat()
.isEqualTo(
"The actual value is an Iterable, and you've written a test that compares it to some "
+ "objects that are not Iterables. Did you instead mean to check whether its "
+ "*contents* match any of the *contents* of the given values? If so, call "
+ "containsNoneOf(...)/containsNoneIn(...) instead. Non-iterables: [a, b]");
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
isNoneOf
|
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() {
calls++;
return super.toString();
}
|
Tests for {@link IterableSubject} APIs, excluding those that use {@link Correspondence} (which
are tested in {@link IterableSubjectCorrespondenceTest}.
@author David Saff
@author Christian Gruber (cgruber@israfil.net)
|
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
@SuppressWarnings("TruthSelfEquals")
public void testIsEqualTo() {
LongStream stream = LongStream.of(42);
assertThat(stream).isEqualTo(stream);
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testIsEqualTo
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
Apache-2.0
|
@Test
public void testIsEqualToList() {
LongStream stream = LongStream.of(42);
List<Long> list = asList(42L);
AssertionError unused = expectFailure(whenTesting -> whenTesting.that(stream).isEqualTo(list));
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testIsEqualToList
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
Apache-2.0
|
@Test
public void testNullStream_fails() {
LongStream nullStream = null;
assertThrows(NullPointerException.class, () -> assertThat(nullStream).isEmpty());
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testNullStream_fails
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
Apache-2.0
|
@Test
public void testNullStreamIsNull() {
LongStream nullStream = null;
assertThat(nullStream).isNull();
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testNullStreamIsNull
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
Apache-2.0
|
@Test
@SuppressWarnings("TruthSelfEquals")
public void testIsSameInstanceAs() {
LongStream stream = LongStream.of(1);
assertThat(stream).isSameInstanceAs(stream);
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testIsSameInstanceAs
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
Apache-2.0
|
@Test
public void testIsEmpty() {
assertThat(LongStream.of()).isEmpty();
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testIsEmpty
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
Apache-2.0
|
@Test
public void testIsEmpty_fails() {
AssertionError unused =
expectFailure(whenTesting -> whenTesting.that(LongStream.of(42)).isEmpty());
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testIsEmpty_fails
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
Apache-2.0
|
@Test
public void testIsNotEmpty() {
assertThat(LongStream.of(42)).isNotEmpty();
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testIsNotEmpty
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
Apache-2.0
|
@Test
public void testIsNotEmpty_fails() {
AssertionError unused =
expectFailure(whenTesting -> whenTesting.that(LongStream.of()).isNotEmpty());
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testIsNotEmpty_fails
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
Apache-2.0
|
@Test
public void testHasSize() {
assertThat(LongStream.of(42)).hasSize(1);
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testHasSize
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
Apache-2.0
|
@Test
public void testHasSize_fails() {
AssertionError unused =
expectFailure(whenTesting -> whenTesting.that(LongStream.of(42)).hasSize(2));
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testHasSize_fails
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
Apache-2.0
|
@Test
public void testContainsNoDuplicates() {
assertThat(LongStream.of(42)).containsNoDuplicates();
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsNoDuplicates
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
Apache-2.0
|
@Test
public void testContainsNoDuplicates_fails() {
AssertionError unused =
expectFailure(
whenTesting -> whenTesting.that(LongStream.of(42, 42)).containsNoDuplicates());
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsNoDuplicates_fails
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
Apache-2.0
|
@Test
public void testContains() {
assertThat(LongStream.of(42)).contains(42);
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContains
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
Apache-2.0
|
@Test
public void testContains_fails() {
AssertionError unused =
expectFailure(whenTesting -> whenTesting.that(LongStream.of(42)).contains(100));
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContains_fails
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
Apache-2.0
|
@Test
public void testContainsAnyOf() {
assertThat(LongStream.of(42)).containsAnyOf(42, 43);
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsAnyOf
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
Apache-2.0
|
@Test
public void testContainsAnyOf_fails() {
AssertionError unused =
expectFailure(whenTesting -> whenTesting.that(LongStream.of(42)).containsAnyOf(43, 44));
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsAnyOf_fails
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
Apache-2.0
|
@Test
public void testContainsAnyIn() {
assertThat(LongStream.of(42)).containsAnyIn(asList(42L, 43L));
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsAnyIn
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongStreamSubjectTest.java
|
Apache-2.0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.