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 comparingValuesUsing_containsAtLeastEntriesIn_inOrder_failsOutOfOrder() { ImmutableMap<String, Integer> expected = ImmutableMap.of("ghi", 789, "abc", 123); ImmutableMap<String, String> actual = ImmutableMap.of("abc", "123", "def", "456", "ghi", "789"); AssertionError e = expectFailure( whenTesting -> whenTesting .that(actual) .comparingValuesUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE) .containsAtLeastEntriesIn(expected) .inOrder()); assertFailureKeys( e, "required entries were all found, but order was wrong", "expected to contain at least", "testing whether", "but was"); }
Tests for {@link Map} subjects. @author Christian Gruber @author Kurt Alfred Kluever
comparingValuesUsing_containsAtLeastEntriesIn_inOrder_failsOutOfOrder
java
google/truth
core/src/test/java/com/google/common/truth/MapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MapSubjectTest.java
Apache-2.0
@Test public void comparingValuesUsing_containsAtLeastEntriesIn_empty() { ImmutableMap<String, Integer> expected = ImmutableMap.of(); ImmutableMap<String, String> actual = ImmutableMap.of("abc", "123", "def", "456"); assertThat(actual) .comparingValuesUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE) .containsAtLeastEntriesIn(expected); }
Tests for {@link Map} subjects. @author Christian Gruber @author Kurt Alfred Kluever
comparingValuesUsing_containsAtLeastEntriesIn_empty
java
google/truth
core/src/test/java/com/google/common/truth/MapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MapSubjectTest.java
Apache-2.0
@Test public void comparingValuesUsing_containsAtLeastEntriesIn_wrongValueTypeInExpectedActual() { ImmutableMap<String, Integer> expected = ImmutableMap.of("def", 456); ImmutableMap<String, Object> actual = ImmutableMap.<String, Object>of("abc", "123", "def", 456); AssertionError e = expectFailure( whenTesting -> whenTesting .that(actual) .comparingValuesUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE) .containsAtLeastEntriesIn(expected)); assertFailureKeys( e, "keys with wrong values", "for key", "expected value", "but got value", "---", "expected to contain at least", "testing whether", "but was", "additionally, one or more exceptions were thrown while comparing values", "first exception"); assertThat(e) .factValue("first exception") .startsWith("compare(456, 456) threw java.lang.ClassCastException"); }
Tests for {@link Map} subjects. @author Christian Gruber @author Kurt Alfred Kluever
comparingValuesUsing_containsAtLeastEntriesIn_wrongValueTypeInExpectedActual
java
google/truth
core/src/test/java/com/google/common/truth/MapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MapSubjectTest.java
Apache-2.0
@Test public void comparingValuesUsing_containsAtLeastEntriesIn_wrongValueTypeInUnexpectedActual_success() { ImmutableMap<String, Integer> expected = ImmutableMap.of("abc", 123); ImmutableMap<String, Object> actual = ImmutableMap.<String, Object>of("abc", "123", "def", 456); assertThat(actual) .comparingValuesUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE) .containsAtLeastEntriesIn(expected); }
Tests for {@link Map} subjects. @author Christian Gruber @author Kurt Alfred Kluever
comparingValuesUsing_containsAtLeastEntriesIn_wrongValueTypeInUnexpectedActual_success
java
google/truth
core/src/test/java/com/google/common/truth/MapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MapSubjectTest.java
Apache-2.0
@Test public void formattingDiffsUsing_success() { ImmutableMap<String, Integer> actual = ImmutableMap.of("ghi", 300, "def", 200, "abc", 100); assertThat(actual) .formattingDiffsUsing(INT_DIFF_FORMATTER) .containsExactly("abc", 100, "def", 200, "ghi", 300); }
Tests for {@link Map} subjects. @author Christian Gruber @author Kurt Alfred Kluever
formattingDiffsUsing_success
java
google/truth
core/src/test/java/com/google/common/truth/MapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MapSubjectTest.java
Apache-2.0
@Test public void formattingDiffsUsing_failure() { ImmutableMap<String, Integer> actual = ImmutableMap.of("ghi", 300, "def", 201, "abc", 100); AssertionError e = expectFailure( whenTesting -> whenTesting .that(actual) .formattingDiffsUsing(INT_DIFF_FORMATTER) .containsExactly("abc", 100, "def", 200, "ghi", 300)); assertFailureKeys( e, "keys with wrong values", "for key", "expected value", "but got value", "diff", "---", "expected", "but was"); assertFailureValue(e, "expected value", "200"); assertFailureValue(e, "but got value", "201"); assertFailureValue(e, "diff", "1"); }
Tests for {@link Map} subjects. @author Christian Gruber @author Kurt Alfred Kluever
formattingDiffsUsing_failure
java
google/truth
core/src/test/java/com/google/common/truth/MapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MapSubjectTest.java
Apache-2.0
@Test public void floatEquals() { assertThat(equalWithinTolerance(1.3f, 1.3f, 0.00000000000001f)).isTrue(); assertThat(equalWithinTolerance(1.3f, 1.3f, 0.0f)).isTrue(); assertThat(equalWithinTolerance(0.0f, 1.0f + 2.0f - 3.0f, 0.00000000000000000000000000000001f)) .isTrue(); assertThat(equalWithinTolerance(1.3f, 1.303f, 0.004f)).isTrue(); assertThat(equalWithinTolerance(1.3f, 1.303f, 0.002f)).isFalse(); assertThat(equalWithinTolerance(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, 0.01f)) .isFalse(); assertThat(equalWithinTolerance(Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY, 0.01f)) .isFalse(); assertThat(equalWithinTolerance(Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY, 0.01f)) .isFalse(); assertThat(equalWithinTolerance(Float.NaN, Float.NaN, 0.01f)).isFalse(); }
Tests for {@link MathUtil} used by numeric subjects. @author Christian Gruber (cgruber@israfil.net)
floatEquals
java
google/truth
core/src/test/java/com/google/common/truth/MathUtilTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MathUtilTest.java
Apache-2.0
@Test public void doubleEquals() { assertThat(equalWithinTolerance(1.3d, 1.3d, 0.00000000000001d)).isTrue(); assertThat(equalWithinTolerance(1.3d, 1.3d, 0.0d)).isTrue(); assertThat(equalWithinTolerance(0.0d, 1.0d + 2.0d - 3.0d, 0.00000000000000000000000000000001d)) .isTrue(); assertThat(equalWithinTolerance(1.3d, 1.303d, 0.004d)).isTrue(); assertThat(equalWithinTolerance(1.3d, 1.303d, 0.002d)).isFalse(); assertThat(equalWithinTolerance(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, 0.01d)) .isFalse(); assertThat(equalWithinTolerance(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, 0.01d)) .isFalse(); assertThat(equalWithinTolerance(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, 0.01d)) .isFalse(); assertThat(equalWithinTolerance(Double.NaN, Double.NaN, 0.01d)).isFalse(); }
Tests for {@link MathUtil} used by numeric subjects. @author Christian Gruber (cgruber@israfil.net)
doubleEquals
java
google/truth
core/src/test/java/com/google/common/truth/MathUtilTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MathUtilTest.java
Apache-2.0
@Test public void floatNotEquals() { assertThat(notEqualWithinTolerance(1.3f, 1.3f, 0.00000000000001f)).isFalse(); assertThat(notEqualWithinTolerance(1.3f, 1.3f, 0.0f)).isFalse(); assertThat( notEqualWithinTolerance(0.0f, 1.0f + 2.0f - 3.0f, 0.00000000000000000000000000000001f)) .isFalse(); assertThat(notEqualWithinTolerance(1.3f, 1.303f, 0.004f)).isFalse(); assertThat(notEqualWithinTolerance(1.3f, 1.303f, 0.002f)).isTrue(); assertThat(notEqualWithinTolerance(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, 0.01f)) .isFalse(); assertThat(notEqualWithinTolerance(Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY, 0.01f)) .isFalse(); assertThat(notEqualWithinTolerance(Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY, 0.01f)) .isFalse(); assertThat(notEqualWithinTolerance(Float.NaN, Float.NaN, 0.01f)).isFalse(); }
Tests for {@link MathUtil} used by numeric subjects. @author Christian Gruber (cgruber@israfil.net)
floatNotEquals
java
google/truth
core/src/test/java/com/google/common/truth/MathUtilTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MathUtilTest.java
Apache-2.0
@Test public void doubleNotEquals() { assertThat(notEqualWithinTolerance(1.3d, 1.3d, 0.00000000000001d)).isFalse(); assertThat(notEqualWithinTolerance(1.3d, 1.3d, 0.0d)).isFalse(); assertThat( notEqualWithinTolerance(0.0d, 1.0d + 2.0d - 3.0d, 0.00000000000000000000000000000001d)) .isFalse(); assertThat(notEqualWithinTolerance(1.3d, 1.303d, 0.004d)).isFalse(); assertThat(notEqualWithinTolerance(1.3d, 1.303d, 0.002d)).isTrue(); assertThat(notEqualWithinTolerance(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, 0.01d)) .isFalse(); assertThat(notEqualWithinTolerance(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, 0.01d)) .isFalse(); assertThat(notEqualWithinTolerance(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, 0.01d)) .isFalse(); assertThat(notEqualWithinTolerance(Double.NaN, Double.NaN, 0.01d)).isFalse(); }
Tests for {@link MathUtil} used by numeric subjects. @author Christian Gruber (cgruber@israfil.net)
doubleNotEquals
java
google/truth
core/src/test/java/com/google/common/truth/MathUtilTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MathUtilTest.java
Apache-2.0
@Test public void equalsDifferentTypes() { assertThat(equalWithinTolerance(1.3d, 1.3f, 0.00000000000001d)).isFalse(); assertThat(equalWithinTolerance(1.3f, 1.3d, 0.00000000000001f)).isFalse(); }
Tests for {@link MathUtil} used by numeric subjects. @author Christian Gruber (cgruber@israfil.net)
equalsDifferentTypes
java
google/truth
core/src/test/java/com/google/common/truth/MathUtilTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MathUtilTest.java
Apache-2.0
@Test public void listMultimapIsEqualTo_passes() { ImmutableListMultimap<String, String> multimapA = ImmutableListMultimap.<String, String>builder() .putAll("kurt", "kluever", "russell", "cobain") .build(); ImmutableListMultimap<String, String> multimapB = ImmutableListMultimap.<String, String>builder() .putAll("kurt", "kluever", "russell", "cobain") .build(); assertThat(multimapA.equals(multimapB)).isTrue(); assertThat(multimapA).isEqualTo(multimapB); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
listMultimapIsEqualTo_passes
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void listMultimapIsEqualTo_fails() { ImmutableListMultimap<String, String> multimapA = ImmutableListMultimap.<String, String>builder() .putAll("kurt", "kluever", "russell", "cobain") .build(); ImmutableListMultimap<String, String> multimapB = ImmutableListMultimap.<String, String>builder() .putAll("kurt", "kluever", "cobain", "russell") .build(); AssertionError e = expectFailure(whenTesting -> whenTesting.that(multimapA).isEqualTo(multimapB)); assertFailureKeys( e, "contents match, but order was wrong", "keys with out-of-order values", "---", "expected", "but was"); assertFailureValue(e, "keys with out-of-order values", "[kurt]"); assertFailureValue(e, "expected", "{kurt=[kluever, cobain, russell]}"); assertFailureValue(e, "but was", "{kurt=[kluever, russell, cobain]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
listMultimapIsEqualTo_fails
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void setMultimapIsEqualTo_passes() { ImmutableSetMultimap<String, String> multimapA = ImmutableSetMultimap.<String, String>builder() .putAll("kurt", "kluever", "russell", "cobain") .build(); ImmutableSetMultimap<String, String> multimapB = ImmutableSetMultimap.<String, String>builder() .putAll("kurt", "kluever", "cobain", "russell") .build(); assertThat(multimapA.equals(multimapB)).isTrue(); assertThat(multimapA).isEqualTo(multimapB); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
setMultimapIsEqualTo_passes
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void setMultimapIsEqualTo_fails() { ImmutableSetMultimap<String, String> multimapA = ImmutableSetMultimap.<String, String>builder() .putAll("kurt", "kluever", "russell", "cobain") .build(); ImmutableSetMultimap<String, String> multimapB = ImmutableSetMultimap.<String, String>builder().putAll("kurt", "kluever", "russell").build(); AssertionError e = expectFailure(whenTesting -> whenTesting.that(multimapA).isEqualTo(multimapB)); assertFailureKeys(e, "unexpected", "---", "expected", "but was"); assertFailureValue(e, "unexpected", "{kurt=[cobain]}"); assertFailureValue(e, "expected", "{kurt=[kluever, russell]}"); assertFailureValue(e, "but was", "{kurt=[kluever, russell, cobain]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
setMultimapIsEqualTo_fails
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void setMultimapIsEqualToListMultimap_fails() { ImmutableSetMultimap<String, String> multimapA = ImmutableSetMultimap.<String, String>builder() .putAll("kurt", "kluever", "russell", "cobain") .build(); ImmutableListMultimap<String, String> multimapB = ImmutableListMultimap.<String, String>builder() .putAll("kurt", "kluever", "russell", "cobain") .build(); AssertionError e = expectFailure(whenTesting -> whenTesting.that(multimapA).isEqualTo(multimapB)); assertFailureKeys( e, "expected", "an instance of", "but was", "an instance of", "a SetMultimap cannot equal a ListMultimap if either is non-empty"); assertFailureValueIndexed(e, "an instance of", 0, "ListMultimap"); assertFailureValueIndexed(e, "an instance of", 1, "SetMultimap"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
setMultimapIsEqualToListMultimap_fails
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void isEqualTo_failsWithSameToString() { AssertionError e = expectFailure( whenTesting -> whenTesting .that(ImmutableMultimap.of(1, "a", 1, "b", 2, "c")) .isEqualTo(ImmutableMultimap.of(1L, "a", 1L, "b", 2L, "c"))); assertFailureKeys(e, "missing", "unexpected", "---", "expected", "but was"); assertFailureValue( e, "missing", "[1=a, 1=b, 2=c] (Map.Entry<java.lang.Long, java.lang.String>)"); assertFailureValue( e, "unexpected", "[1=a, 1=b, 2=c] (Map.Entry<java.lang.Integer, java.lang.String>)"); assertFailureValue(e, "expected", "{1=[a, b], 2=[c]}"); assertFailureValue(e, "but was", "{1=[a, b], 2=[c]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
isEqualTo_failsWithSameToString
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void multimapIsEmpty() { ImmutableMultimap<String, String> multimap = ImmutableMultimap.of(); assertThat(multimap).isEmpty(); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
multimapIsEmpty
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void multimapIsEmptyWithFailure() { ImmutableMultimap<Integer, Integer> multimap = ImmutableMultimap.of(1, 5); AssertionError e = expectFailure(whenTesting -> whenTesting.that(multimap).isEmpty()); assertFailureKeys(e, "expected to be empty", "but was"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
multimapIsEmptyWithFailure
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void multimapIsNotEmpty() { ImmutableMultimap<Integer, Integer> multimap = ImmutableMultimap.of(1, 5); assertThat(multimap).isNotEmpty(); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
multimapIsNotEmpty
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void multimapIsNotEmptyWithFailure() { ImmutableMultimap<Integer, Integer> multimap = ImmutableMultimap.of(); AssertionError e = expectFailure(whenTesting -> whenTesting.that(multimap).isNotEmpty()); assertFailureKeys(e, "expected not to be empty"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
multimapIsNotEmptyWithFailure
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void hasSize() { assertThat(ImmutableMultimap.of(1, 2, 3, 4)).hasSize(2); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
hasSize
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void hasSizeZero() { assertThat(ImmutableMultimap.of()).hasSize(0); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
hasSizeZero
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void hasSizeNegative() { assertThrows( IllegalArgumentException.class, () -> assertThat(ImmutableMultimap.of(1, 2)).hasSize(-1)); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
hasSizeNegative
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsKey() { ImmutableMultimap<String, String> multimap = ImmutableMultimap.of("kurt", "kluever"); assertThat(multimap).containsKey("kurt"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsKey
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsKeyFailure() { ImmutableMultimap<String, String> multimap = ImmutableMultimap.of("kurt", "kluever"); AssertionError e = expectFailure(whenTesting -> whenTesting.that(multimap).containsKey("daniel")); assertFailureKeys(e, "value of", "expected to contain", "but was", "multimap was"); assertFailureValue(e, "value of", "multimap.keySet()"); assertFailureValue(e, "expected to contain", "daniel"); assertFailureValue(e, "but was", "[kurt]"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsKeyFailure
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsKeyNull() { Multimap<String, String> multimap = HashMultimap.create(); multimap.put(null, "null"); assertThat(multimap).containsKey(null); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsKeyNull
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsKeyNullFailure() { ImmutableMultimap<String, String> multimap = ImmutableMultimap.of("kurt", "kluever"); AssertionError e = expectFailure(whenTesting -> whenTesting.that(multimap).containsKey(null)); assertFailureKeys(e, "value of", "expected to contain", "but was", "multimap was"); assertFailureValue(e, "value of", "multimap.keySet()"); assertFailureValue(e, "expected to contain", "null"); assertFailureValue(e, "but was", "[kurt]"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsKeyNullFailure
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsKey_failsWithSameToString() { AssertionError e = expectFailure( whenTesting -> whenTesting .that( ImmutableMultimap.of( 1L, "value1a", 1L, "value1b", 2L, "value2", "1", "value3")) .containsKey(1)); assertFailureKeys( e, "value of", "expected to contain", "an instance of", "but did not", "though it did contain", "full contents", "multimap was"); assertFailureValue(e, "value of", "multimap.keySet()"); assertFailureValue(e, "expected to contain", "1"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsKey_failsWithSameToString
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void doesNotContainKey() { ImmutableMultimap<String, String> multimap = ImmutableMultimap.of("kurt", "kluever"); assertThat(multimap).doesNotContainKey("daniel"); assertThat(multimap).doesNotContainKey(null); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
doesNotContainKey
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void doesNotContainKeyFailure() { ImmutableMultimap<String, String> multimap = ImmutableMultimap.of("kurt", "kluever"); AssertionError e = expectFailure(whenTesting -> whenTesting.that(multimap).doesNotContainKey("kurt")); assertFailureKeys(e, "value of", "expected not to contain", "but was", "multimap was"); assertFailureValue(e, "value of", "multimap.keySet()"); assertFailureValue(e, "expected not to contain", "kurt"); assertFailureValue(e, "but was", "[kurt]"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
doesNotContainKeyFailure
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void doesNotContainNullKeyFailure() { Multimap<String, String> multimap = HashMultimap.create(); multimap.put(null, "null"); AssertionError e = expectFailure(whenTesting -> whenTesting.that(multimap).doesNotContainKey(null)); assertFailureKeys(e, "value of", "expected not to contain", "but was", "multimap was"); assertFailureValue(e, "value of", "multimap.keySet()"); assertFailureValue(e, "expected not to contain", "null"); assertFailureValue(e, "but was", "[null]"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
doesNotContainNullKeyFailure
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsEntry() { ImmutableMultimap<String, String> multimap = ImmutableMultimap.of("kurt", "kluever"); assertThat(multimap).containsEntry("kurt", "kluever"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsEntry
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsEntryFailure() { ImmutableMultimap<String, String> multimap = ImmutableMultimap.of("kurt", "kluever"); AssertionError e = expectFailure(whenTesting -> whenTesting.that(multimap).containsEntry("daniel", "ploch")); assertFailureKeys(e, "expected to contain entry", "but was"); assertFailureValue(e, "expected to contain entry", "daniel=ploch"); assertFailureValue(e, "but was", "{kurt=[kluever]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsEntryFailure
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsEntryWithNullValueNullExpected() { ListMultimap<String, String> actual = ArrayListMultimap.create(); actual.put("a", null); assertThat(actual).containsEntry("a", null); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsEntryWithNullValueNullExpected
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void failContainsEntry() { ImmutableMultimap<String, String> actual = ImmutableMultimap.of("a", "A"); AssertionError e = expectFailure(whenTesting -> whenTesting.that(actual).containsEntry("b", "B")); assertFailureKeys(e, "expected to contain entry", "but was"); assertFailureValue(e, "expected to contain entry", "b=B"); assertFailureValue(e, "but was", "{a=[A]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
failContainsEntry
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void failContainsEntryFailsWithWrongValueForKey() { ImmutableMultimap<String, String> actual = ImmutableMultimap.of("a", "A"); AssertionError e = expectFailure(whenTesting -> whenTesting.that(actual).containsEntry("a", "a")); assertFailureKeys( e, "expected to contain entry", "but did not", "though it did contain values with that key", "full contents"); assertFailureValue(e, "though it did contain values with that key", "[A]"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
failContainsEntryFailsWithWrongValueForKey
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void failContainsEntryWithNullValuePresentExpected() { ListMultimap<String, String> actual = ArrayListMultimap.create(); actual.put("a", null); AssertionError e = expectFailure(whenTesting -> whenTesting.that(actual).containsEntry("a", "A")); assertFailureKeys( e, "expected to contain entry", "but did not", "though it did contain values with that key", "full contents"); assertFailureValue(e, "though it did contain values with that key", "[null]"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
failContainsEntryWithNullValuePresentExpected
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void failContainsEntryWithPresentValueNullExpected() { ImmutableMultimap<String, String> actual = ImmutableMultimap.of("a", "A"); AssertionError e = expectFailure(whenTesting -> whenTesting.that(actual).containsEntry("a", null)); assertFailureKeys( e, "expected to contain entry", "but did not", "though it did contain values with that key", "full contents"); assertFailureValue(e, "expected to contain entry", "a=null"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
failContainsEntryWithPresentValueNullExpected
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void failContainsEntryFailsWithWrongKeyForValue() { ImmutableMultimap<String, String> actual = ImmutableMultimap.of("a", "A"); AssertionError e = expectFailure(whenTesting -> whenTesting.that(actual).containsEntry("b", "A")); assertFailureKeys( e, "expected to contain entry", "but did not", "though it did contain keys with that value", "full contents"); assertFailureValue(e, "though it did contain keys with that value", "[a]"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
failContainsEntryFailsWithWrongKeyForValue
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsEntry_failsWithSameToString() { AssertionError e = expectFailure( whenTesting -> whenTesting .that( ImmutableMultimap.builder() .put(1, "1") .put(1, 1L) .put(1L, 1) .put(2, 3) .build()) .containsEntry(1, 1)); assertFailureKeys( e, "expected to contain entry", "an instance of", "but did not", "though it did contain", "full contents"); assertFailureValue(e, "expected to contain entry", "1=1"); assertFailureValue(e, "an instance of", "Map.Entry<java.lang.Integer, java.lang.Integer>"); assertFailureValue( e, "though it did contain", "[1=1 (Map.Entry<java.lang.Integer, java.lang.String>), " + "1=1 (Map.Entry<java.lang.Integer, java.lang.Long>), " + "1=1 (Map.Entry<java.lang.Long, java.lang.Integer>)]"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsEntry_failsWithSameToString
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void doesNotContainEntry() { ImmutableMultimap<String, String> multimap = ImmutableMultimap.of("kurt", "kluever"); assertThat(multimap).doesNotContainEntry("daniel", "ploch"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
doesNotContainEntry
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void doesNotContainEntryFailure() { ImmutableMultimap<String, String> multimap = ImmutableMultimap.of("kurt", "kluever"); AssertionError e = expectFailure( whenTesting -> whenTesting.that(multimap).doesNotContainEntry("kurt", "kluever")); assertFailureKeys(e, "value of", "expected not to contain", "but was"); assertFailureValue(e, "value of", "multimap.entries()"); assertFailureValue(e, "expected not to contain", "kurt=kluever"); assertFailureValue(e, "but was", "[kurt=kluever]"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
doesNotContainEntryFailure
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void valuesForKey() { ImmutableMultimap<Integer, String> multimap = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); assertThat(multimap).valuesForKey(3).hasSize(3); assertThat(multimap).valuesForKey(4).containsExactly("four", "five"); assertThat(multimap).valuesForKey(3).containsAtLeast("one", "six").inOrder(); assertThat(multimap).valuesForKey(5).isEmpty(); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
valuesForKey
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void valuesForKeyListMultimap() { ImmutableListMultimap<Integer, String> multimap = ImmutableListMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); assertThat(multimap).valuesForKey(4).isInStrictOrder(); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
valuesForKeyListMultimap
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyEntriesIn() { ImmutableListMultimap<Integer, String> listMultimap = ImmutableListMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); ImmutableSetMultimap<Integer, String> setMultimap = ImmutableSetMultimap.copyOf(listMultimap); assertThat(listMultimap).containsExactlyEntriesIn(setMultimap); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyEntriesIn
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyNoArg() { ImmutableMultimap<Integer, String> actual = ImmutableMultimap.of(); assertThat(actual).containsExactly(); assertThat(actual).containsExactly().inOrder(); AssertionError e = expectFailure( whenTesting -> whenTesting.that(ImmutableMultimap.of(42, "Answer", 42, "6x7")).containsExactly()); assertFailureKeys(e, "expected to be empty", "but was"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyNoArg
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyEmpty() { ImmutableListMultimap<Integer, String> actual = ImmutableListMultimap.of(); ImmutableSetMultimap<Integer, String> expected = ImmutableSetMultimap.of(); assertThat(actual).containsExactlyEntriesIn(expected); assertThat(actual).containsExactlyEntriesIn(expected).inOrder(); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyEmpty
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyRejectsNull() { ImmutableMultimap<Integer, String> multimap = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); assertThrows( NullPointerException.class, () -> assertThat(multimap).containsExactlyEntriesIn(null)); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyRejectsNull
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyRespectsDuplicates() { ImmutableListMultimap<Integer, String> actual = ImmutableListMultimap.of(3, "one", 3, "two", 3, "one", 4, "five", 4, "five"); ImmutableListMultimap<Integer, String> expected = ImmutableListMultimap.of(3, "two", 4, "five", 3, "one", 4, "five", 3, "one"); assertThat(actual).containsExactlyEntriesIn(expected); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyRespectsDuplicates
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyRespectsDuplicatesFailure() { ImmutableListMultimap<Integer, String> actual = ImmutableListMultimap.of(3, "one", 3, "two", 3, "one", 4, "five", 4, "five"); ImmutableSetMultimap<Integer, String> expected = ImmutableSetMultimap.copyOf(actual); AssertionError e = expectFailure(whenTesting -> whenTesting.that(actual).containsExactlyEntriesIn(expected)); assertFailureKeys(e, "unexpected", "---", "expected", "but was"); assertFailureValue(e, "unexpected", "{3=[one], 4=[five]}"); assertFailureValue(e, "expected", "{3=[one, two], 4=[five]}"); assertFailureValue(e, "but was", "{3=[one, two, one], 4=[five, five]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyRespectsDuplicatesFailure
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyFailureMissing() { ImmutableMultimap<Integer, String> expected = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); ListMultimap<Integer, String> actual = LinkedListMultimap.create(expected); actual.remove(3, "six"); actual.remove(4, "five"); AssertionError e = expectFailure(whenTesting -> whenTesting.that(actual).containsExactlyEntriesIn(expected)); assertFailureKeys(e, "missing", "---", "expected", "but was"); assertFailureValue(e, "missing", "{3=[six], 4=[five]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyFailureMissing
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyFailureExtra() { ImmutableMultimap<Integer, String> expected = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); ListMultimap<Integer, String> actual = LinkedListMultimap.create(expected); actual.put(4, "nine"); actual.put(5, "eight"); AssertionError e = expectFailure(whenTesting -> whenTesting.that(actual).containsExactlyEntriesIn(expected)); assertFailureKeys(e, "unexpected", "---", "expected", "but was"); assertFailureValue(e, "unexpected", "{4=[nine], 5=[eight]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyFailureExtra
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyFailureBoth() { ImmutableMultimap<Integer, String> expected = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); ListMultimap<Integer, String> actual = LinkedListMultimap.create(expected); actual.remove(3, "six"); actual.remove(4, "five"); actual.put(4, "nine"); actual.put(5, "eight"); AssertionError e = expectFailure(whenTesting -> whenTesting.that(actual).containsExactlyEntriesIn(expected)); assertFailureKeys(e, "missing", "unexpected", "---", "expected", "but was"); assertFailureValue(e, "missing", "{3=[six], 4=[five]}"); assertFailureValue(e, "unexpected", "{4=[nine], 5=[eight]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyFailureBoth
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyFailureWithEmptyStringMissing() { AssertionError e = expectFailure( whenTesting -> whenTesting.that(ImmutableMultimap.of()).containsExactly("", "a")); assertFailureKeys(e, "missing", "---", "expected", "but was"); assertFailureValue(e, "missing", "{\"\" (empty String)=[a]}"); assertFailureValue(e, "expected", "{\"\" (empty String)=[a]}"); assertFailureValue(e, "but was", "{}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyFailureWithEmptyStringMissing
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyFailureWithEmptyStringExtra() { AssertionError e = expectFailure( whenTesting -> whenTesting.that(ImmutableMultimap.of("a", "", "", "")).containsExactly("a", "")); assertFailureKeys(e, "unexpected", "---", "expected", "but was"); assertFailureValue(e, "unexpected", "{\"\" (empty String)=[\"\" (empty String)]}"); assertFailureValue(e, "expected", "{a=[\"\" (empty String)]}"); assertFailureValue(e, "but was", "{a=[], =[]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyFailureWithEmptyStringExtra
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyFailureWithEmptyStringBoth() { AssertionError e = expectFailure( whenTesting -> whenTesting.that(ImmutableMultimap.of("a", "")).containsExactly("", "a")); assertFailureKeys(e, "missing", "unexpected", "---", "expected", "but was"); assertFailureValue(e, "missing", "{\"\" (empty String)=[a]}"); assertFailureValue(e, "unexpected", "{a=[\"\" (empty String)]}"); assertFailureValue(e, "expected", "{\"\" (empty String)=[a]}"); assertFailureValue(e, "but was", "{a=[]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyFailureWithEmptyStringBoth
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyInOrder() { ImmutableMultimap<Integer, String> actual = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); ImmutableMultimap<Integer, String> expected = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); assertThat(actual).containsExactlyEntriesIn(expected).inOrder(); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyInOrder
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyInOrderDifferentTypes() { ImmutableListMultimap<Integer, String> listMultimap = ImmutableListMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); ImmutableSetMultimap<Integer, String> setMultimap = ImmutableSetMultimap.copyOf(listMultimap); assertThat(listMultimap).containsExactlyEntriesIn(setMultimap).inOrder(); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyInOrderDifferentTypes
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyInOrderFailure() { ImmutableMultimap<Integer, String> actual = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); ImmutableMultimap<Integer, String> expected = ImmutableMultimap.of(4, "four", 3, "six", 4, "five", 3, "two", 3, "one"); assertThat(actual).containsExactlyEntriesIn(expected); AssertionError e = expectFailure( whenTesting -> whenTesting.that(actual).containsExactlyEntriesIn(expected).inOrder()); assertFailureKeys( e, "contents match, but order was wrong", "keys are not in order", "keys with out-of-order values", "---", "expected", "but was"); assertFailureValue(e, "keys with out-of-order values", "[4, 3]"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyInOrderFailure
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyInOrderFailureValuesOnly() { ImmutableMultimap<Integer, String> actual = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); ImmutableMultimap<Integer, String> expected = ImmutableMultimap.of(3, "six", 3, "two", 3, "one", 4, "five", 4, "four"); assertThat(actual).containsExactlyEntriesIn(expected); AssertionError e = expectFailure( whenTesting -> whenTesting.that(actual).containsExactlyEntriesIn(expected).inOrder()); assertFailureKeys( e, "contents match, but order was wrong", "keys with out-of-order values", "---", "expected", "but was"); assertFailureValue(e, "keys with out-of-order values", "[3]"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyInOrderFailureValuesOnly
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyVararg() { ImmutableListMultimap<Integer, String> listMultimap = ImmutableListMultimap.of(1, "one", 3, "six", 3, "two"); assertThat(listMultimap).containsExactly(1, "one", 3, "six", 3, "two"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyVararg
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyVarargWithNull() { Multimap<Integer, String> listMultimap = LinkedListMultimap.create(ImmutableListMultimap.of(1, "one", 3, "six", 3, "two")); listMultimap.put(4, null); assertThat(listMultimap).containsExactly(1, "one", 3, "six", 3, "two", 4, null); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyVarargWithNull
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyVarargFailureMissing() { ImmutableMultimap<Integer, String> expected = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); ListMultimap<Integer, String> actual = LinkedListMultimap.create(expected); actual.remove(3, "six"); actual.remove(4, "five"); AssertionError e = expectFailure( whenTesting -> whenTesting .that(actual) .containsExactly(3, "one", 3, "six", 3, "two", 4, "five", 4, "four")); assertFailureKeys(e, "missing", "---", "expected", "but was"); assertFailureValue(e, "missing", "{3=[six], 4=[five]}"); assertFailureValue(e, "expected", "{3=[one, six, two], 4=[five, four]}"); assertFailureValue(e, "but was", "{3=[one, two], 4=[four]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyVarargFailureMissing
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyVarargFailureExtra() { ImmutableMultimap<Integer, String> expected = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); ListMultimap<Integer, String> actual = LinkedListMultimap.create(expected); actual.put(4, "nine"); actual.put(5, "eight"); AssertionError e = expectFailure( whenTesting -> whenTesting .that(actual) .containsExactly(3, "one", 3, "six", 3, "two", 4, "five", 4, "four")); assertFailureKeys(e, "unexpected", "---", "expected", "but was"); assertFailureValue(e, "unexpected", "{4=[nine], 5=[eight]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyVarargFailureExtra
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyVarargFailureBoth() { ImmutableMultimap<Integer, String> expected = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); ListMultimap<Integer, String> actual = LinkedListMultimap.create(expected); actual.remove(3, "six"); actual.remove(4, "five"); actual.put(4, "nine"); actual.put(5, "eight"); AssertionError e = expectFailure( whenTesting -> whenTesting .that(actual) .containsExactly(3, "one", 3, "six", 3, "two", 4, "five", 4, "four")); assertFailureKeys(e, "missing", "unexpected", "---", "expected", "but was"); assertFailureValue(e, "missing", "{3=[six], 4=[five]}"); assertFailureValue(e, "unexpected", "{4=[nine], 5=[eight]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyVarargFailureBoth
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyVarargRespectsDuplicates() { ImmutableListMultimap<Integer, String> actual = ImmutableListMultimap.of(3, "one", 3, "two", 3, "one", 4, "five", 4, "five"); assertThat(actual).containsExactly(3, "two", 4, "five", 3, "one", 4, "five", 3, "one"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyVarargRespectsDuplicates
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyVarargRespectsDuplicatesFailure() { ImmutableListMultimap<Integer, String> actual = ImmutableListMultimap.of(3, "one", 3, "two", 3, "one", 4, "five", 4, "five"); AssertionError e = expectFailure( whenTesting -> whenTesting.that(actual).containsExactly(3, "one", 3, "two", 4, "five")); assertFailureKeys(e, "unexpected", "---", "expected", "but was"); assertFailureValue(e, "unexpected", "{3=[one], 4=[five]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyVarargRespectsDuplicatesFailure
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyVarargInOrder() { ImmutableMultimap<Integer, String> actual = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); assertThat(actual) .containsExactly(3, "one", 3, "six", 3, "two", 4, "five", 4, "four") .inOrder(); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyVarargInOrder
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyVarargInOrderFailure() { ImmutableMultimap<Integer, String> actual = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); assertThat(actual).containsExactly(4, "four", 3, "six", 4, "five", 3, "two", 3, "one"); AssertionError e = expectFailure( whenTesting -> whenTesting .that(actual) .containsExactly(4, "four", 3, "six", 4, "five", 3, "two", 3, "one") .inOrder()); assertFailureKeys( e, "contents match, but order was wrong", "keys are not in order", "keys with out-of-order values", "---", "expected", "but was"); assertFailureValue(e, "keys with out-of-order values", "[4, 3]"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyVarargInOrderFailure
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyVarargInOrderFailureValuesOnly() { ImmutableMultimap<Integer, String> actual = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); assertThat(actual).containsExactly(3, "six", 3, "two", 3, "one", 4, "five", 4, "four"); AssertionError e = expectFailure( whenTesting -> whenTesting .that(actual) .containsExactly(3, "six", 3, "two", 3, "one", 4, "five", 4, "four") .inOrder()); assertFailureKeys( e, "contents match, but order was wrong", "keys with out-of-order values", "---", "expected", "but was"); assertFailureValue(e, "keys with out-of-order values", "[3]"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyVarargInOrderFailureValuesOnly
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyEntriesIn_homogeneousMultimap_failsWithSameToString() { AssertionError e = expectFailure( whenTesting -> whenTesting .that(ImmutableMultimap.of(1, "a", 1, "b", 2, "c")) .containsExactlyEntriesIn(ImmutableMultimap.of(1L, "a", 1L, "b", 2L, "c"))); assertFailureKeys(e, "missing", "unexpected", "---", "expected", "but was"); assertFailureValue( e, "missing", "[1=a, 1=b, 2=c] (Map.Entry<java.lang.Long, java.lang.String>)"); assertFailureValue( e, "unexpected", "[1=a, 1=b, 2=c] (Map.Entry<java.lang.Integer, java.lang.String>)"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyEntriesIn_homogeneousMultimap_failsWithSameToString
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsExactlyEntriesIn_heterogeneousMultimap_failsWithSameToString() { AssertionError e = expectFailure( whenTesting -> whenTesting .that(ImmutableMultimap.of(1, "a", 1, "b", 2L, "c")) .containsExactlyEntriesIn(ImmutableMultimap.of(1L, "a", 1L, "b", 2, "c"))); assertFailureKeys(e, "missing", "unexpected", "---", "expected", "but was"); assertFailureValue( e, "missing", "[1=a (Map.Entry<java.lang.Long, java.lang.String>), " + "1=b (Map.Entry<java.lang.Long, java.lang.String>), " + "2=c (Map.Entry<java.lang.Integer, java.lang.String>)]"); assertFailureValue( e, "unexpected", "[1=a (Map.Entry<java.lang.Integer, java.lang.String>), " + "1=b (Map.Entry<java.lang.Integer, java.lang.String>), " + "2=c (Map.Entry<java.lang.Long, java.lang.String>)]"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsExactlyEntriesIn_heterogeneousMultimap_failsWithSameToString
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsAtLeastEntriesIn() { ImmutableListMultimap<Integer, String> actual = ImmutableListMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); ImmutableSetMultimap<Integer, String> expected = ImmutableSetMultimap.of(3, "one", 3, "six", 3, "two", 4, "five"); assertThat(actual).containsAtLeastEntriesIn(expected); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsAtLeastEntriesIn
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsAtLeastEmpty() { ImmutableListMultimap<Integer, String> actual = ImmutableListMultimap.of(3, "one"); ImmutableSetMultimap<Integer, String> expected = ImmutableSetMultimap.of(); assertThat(actual).containsAtLeastEntriesIn(expected); assertThat(actual).containsAtLeastEntriesIn(expected).inOrder(); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsAtLeastEmpty
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsAtLeastRejectsNull() { ImmutableMultimap<Integer, String> multimap = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); assertThrows( NullPointerException.class, () -> assertThat(multimap).containsAtLeastEntriesIn(null)); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsAtLeastRejectsNull
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsAtLeastRespectsDuplicates() { ImmutableListMultimap<Integer, String> actual = ImmutableListMultimap.of(3, "one", 3, "two", 3, "one", 4, "five", 4, "five"); ImmutableListMultimap<Integer, String> expected = ImmutableListMultimap.of(3, "two", 4, "five", 3, "one", 4, "five", 3, "one"); assertThat(actual).containsAtLeastEntriesIn(expected); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsAtLeastRespectsDuplicates
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsAtLeastRespectsDuplicatesFailure() { ImmutableListMultimap<Integer, String> expected = ImmutableListMultimap.of(3, "one", 3, "two", 3, "one", 4, "five", 4, "five"); ImmutableSetMultimap<Integer, String> actual = ImmutableSetMultimap.copyOf(expected); AssertionError e = expectFailure(whenTesting -> whenTesting.that(actual).containsAtLeastEntriesIn(expected)); assertFailureKeys(e, "missing", "---", "expected to contain at least", "but was"); assertFailureValue(e, "missing", "{3=[one], 4=[five]}"); assertFailureValue(e, "expected to contain at least", "{3=[one, two, one], 4=[five, five]}"); assertFailureValue(e, "but was", "{3=[one, two], 4=[five]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsAtLeastRespectsDuplicatesFailure
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsAtLeastFailureMissing() { ImmutableMultimap<Integer, String> expected = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); ListMultimap<Integer, String> actual = LinkedListMultimap.create(expected); actual.remove(3, "six"); actual.remove(4, "five"); actual.put(50, "hawaii"); AssertionError e = expectFailure(whenTesting -> whenTesting.that(actual).containsAtLeastEntriesIn(expected)); assertFailureKeys(e, "missing", "---", "expected to contain at least", "but was"); assertFailureValue(e, "missing", "{3=[six], 4=[five]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsAtLeastFailureMissing
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsAtLeastFailureWithEmptyStringMissing() { AssertionError e = expectFailure( whenTesting -> whenTesting.that(ImmutableMultimap.of("key", "value")).containsAtLeast("", "a")); assertFailureKeys(e, "missing", "---", "expected to contain at least", "but was"); assertFailureValue(e, "missing", "{\"\" (empty String)=[a]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsAtLeastFailureWithEmptyStringMissing
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsAtLeastInOrder() { ImmutableMultimap<Integer, String> actual = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); ImmutableMultimap<Integer, String> expected = ImmutableMultimap.of(3, "one", 3, "six", 4, "five", 4, "four"); assertThat(actual).containsAtLeastEntriesIn(expected).inOrder(); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsAtLeastInOrder
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsAtLeastInOrderDifferentTypes() { ImmutableListMultimap<Integer, String> actual = ImmutableListMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); ImmutableSetMultimap<Integer, String> expected = ImmutableSetMultimap.of(3, "one", 3, "six", 4, "five", 4, "four"); assertThat(actual).containsAtLeastEntriesIn(expected).inOrder(); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsAtLeastInOrderDifferentTypes
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsAtLeastInOrderFailure() { ImmutableMultimap<Integer, String> actual = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); ImmutableMultimap<Integer, String> expected = ImmutableMultimap.of(4, "four", 3, "six", 3, "two", 3, "one"); assertThat(actual).containsAtLeastEntriesIn(expected); AssertionError e = expectFailure( whenTesting -> whenTesting.that(actual).containsAtLeastEntriesIn(expected).inOrder()); assertFailureKeys( e, "contents match, but order was wrong", "keys are not in order", "keys with out-of-order values", "---", "expected to contain at least", "but was"); assertFailureValue(e, "keys with out-of-order values", "[3]"); assertFailureValue(e, "expected to contain at least", "{4=[four], 3=[six, two, one]}"); assertFailureValue(e, "but was", "{3=[one, six, two], 4=[five, four]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsAtLeastInOrderFailure
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsAtLeastInOrderFailureValuesOnly() { ImmutableMultimap<Integer, String> actual = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); ImmutableMultimap<Integer, String> expected = ImmutableMultimap.of(3, "six", 3, "one", 4, "five", 4, "four"); assertThat(actual).containsAtLeastEntriesIn(expected); AssertionError e = expectFailure( whenTesting -> whenTesting.that(actual).containsAtLeastEntriesIn(expected).inOrder()); assertFailureKeys( e, "contents match, but order was wrong", "keys with out-of-order values", "---", "expected to contain at least", "but was"); assertFailureValue(e, "keys with out-of-order values", "[3]"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsAtLeastInOrderFailureValuesOnly
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsAtLeastVararg() { ImmutableListMultimap<Integer, String> listMultimap = ImmutableListMultimap.of(1, "one", 3, "six", 3, "two", 3, "one"); assertThat(listMultimap).containsAtLeast(1, "one", 3, "six", 3, "two"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsAtLeastVararg
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsAtLeastVarargWithNull() { Multimap<Integer, String> listMultimap = LinkedListMultimap.create(ImmutableListMultimap.of(1, "one", 3, "six", 3, "two")); listMultimap.put(4, null); assertThat(listMultimap).containsAtLeast(1, "one", 3, "two", 4, null); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsAtLeastVarargWithNull
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsAtLeastVarargFailureMissing() { ImmutableMultimap<Integer, String> expected = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); ListMultimap<Integer, String> actual = LinkedListMultimap.create(expected); actual.remove(3, "six"); actual.remove(4, "five"); actual.put(3, "nine"); AssertionError e = expectFailure( whenTesting -> whenTesting .that(actual) .containsAtLeast(3, "one", 3, "six", 3, "two", 4, "five", 4, "four")); assertFailureKeys(e, "missing", "---", "expected to contain at least", "but was"); assertFailureValue(e, "missing", "{3=[six], 4=[five]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsAtLeastVarargFailureMissing
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsAtLeastVarargRespectsDuplicates() { ImmutableListMultimap<Integer, String> actual = ImmutableListMultimap.of(3, "one", 3, "two", 3, "one", 4, "five", 4, "five"); assertThat(actual).containsAtLeast(3, "two", 4, "five", 3, "one", 3, "one"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsAtLeastVarargRespectsDuplicates
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsAtLeastVarargRespectsDuplicatesFailure() { ImmutableListMultimap<Integer, String> actual = ImmutableListMultimap.of(3, "one", 3, "two", 4, "five", 4, "five"); AssertionError e = expectFailure( whenTesting -> whenTesting.that(actual).containsAtLeast(3, "one", 3, "one", 3, "one", 4, "five")); assertFailureKeys(e, "missing", "---", "expected to contain at least", "but was"); assertFailureValue(e, "missing", "{3=[one [2 copies]]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsAtLeastVarargRespectsDuplicatesFailure
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsAtLeastVarargInOrder() { ImmutableMultimap<Integer, String> actual = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); assertThat(actual).containsAtLeast(3, "one", 3, "six", 4, "five", 4, "four").inOrder(); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsAtLeastVarargInOrder
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsAtLeastVarargInOrderFailure() { ImmutableMultimap<Integer, String> actual = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); assertThat(actual).containsAtLeast(4, "four", 3, "six", 3, "two", 3, "one"); AssertionError e = expectFailure( whenTesting -> whenTesting .that(actual) .containsAtLeast(4, "four", 3, "six", 3, "two", 3, "one") .inOrder()); assertFailureKeys( e, "contents match, but order was wrong", "keys are not in order", "keys with out-of-order values", "---", "expected to contain at least", "but was"); assertFailureValue(e, "keys with out-of-order values", "[3]"); assertFailureValue(e, "expected to contain at least", "{4=[four], 3=[six, two, one]}"); assertFailureValue(e, "but was", "{3=[one, six, two], 4=[five, four]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsAtLeastVarargInOrderFailure
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void containsAtLeastVarargInOrderFailureValuesOnly() { ImmutableMultimap<Integer, String> actual = ImmutableMultimap.of(3, "one", 3, "six", 3, "two", 4, "five", 4, "four"); assertThat(actual).containsAtLeast(3, "two", 3, "one", 4, "five", 4, "four"); AssertionError e = expectFailure( whenTesting -> whenTesting .that(actual) .containsAtLeast(3, "two", 3, "one", 4, "five", 4, "four") .inOrder()); assertFailureKeys( e, "contents match, but order was wrong", "keys with out-of-order values", "---", "expected to contain at least", "but was"); assertFailureValue(e, "keys with out-of-order values", "[3]"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
containsAtLeastVarargInOrderFailureValuesOnly
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void comparingValuesUsing_containsEntry_success() { ImmutableListMultimap<String, String> actual = ImmutableListMultimap.of("abc", "+123", "def", "+456", "def", "+789"); assertThat(actual) .comparingValuesUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE) .containsEntry("def", 789); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
comparingValuesUsing_containsEntry_success
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void comparingValuesUsing_containsEntry_failsExpectedKeyHasWrongValues() { ImmutableListMultimap<String, String> actual = ImmutableListMultimap.of("abc", "+123", "def", "+456", "def", "+789"); AssertionError e = expectFailure( whenTesting -> whenTesting .that(actual) .comparingValuesUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE) .containsEntry("def", 123)); assertFailureKeys( e, "expected to contain entry", "testing whether", "but did not", "though it did contain values for that key", "full contents"); assertFailureValue(e, "expected to contain entry", "def=123"); assertFailureValue(e, "testing whether", "actual value parses to expected value"); assertFailureValue(e, "though it did contain values for that key", "[+456, +789]"); assertFailureValue(e, "full contents", "{abc=[+123], def=[+456, +789]}"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
comparingValuesUsing_containsEntry_failsExpectedKeyHasWrongValues
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void comparingValuesUsing_containsEntry_failsWrongKeyHasExpectedValue() { ImmutableListMultimap<String, String> actual = ImmutableListMultimap.of("abc", "+123", "def", "+456", "def", "+789"); AssertionError e = expectFailure( whenTesting -> whenTesting .that(actual) .comparingValuesUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE) .containsEntry("xyz", 789)); assertFailureKeys( e, "expected to contain entry", "testing whether", "but did not", "though it did contain entries with matching values", "full contents"); assertFailureValue(e, "though it did contain entries with matching values", "[def=+789]"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
comparingValuesUsing_containsEntry_failsWrongKeyHasExpectedValue
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void comparingValuesUsing_containsEntry_failsMissingExpectedKeyAndValue() { ImmutableListMultimap<String, String> actual = ImmutableListMultimap.of("abc", "+123", "def", "+456", "def", "+789"); AssertionError e = expectFailure( whenTesting -> whenTesting .that(actual) .comparingValuesUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE) .containsEntry("xyz", 321)); assertFailureKeys( e, "expected to contain entry", "testing whether", "but did not", "full contents"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
comparingValuesUsing_containsEntry_failsMissingExpectedKeyAndValue
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void comparingValuesUsing_containsEntry_handlesException_expectedKeyHasWrongValues() { ListMultimap<Integer, String> actual = LinkedListMultimap.create(); actual.put(1, "one"); actual.put(2, "two"); actual.put(2, "deux"); actual.put(2, null); AssertionError e = expectFailure( whenTesting -> whenTesting .that(actual) .comparingValuesUsing(CASE_INSENSITIVE_EQUALITY) .containsEntry(2, "ZWEI")); // The test fails because the expected key doesn't have a match for the expected value. We are // bound also to hit a NPE from compare(null, ZWEI) along the way, and should also report that. assertFailureKeys( e, "expected to contain entry", "testing whether", "but did not", "though it did contain values for that key", "full contents", "additionally, one or more exceptions were thrown while comparing values", "first exception"); assertThat(e) .factValue("first exception") .startsWith("compare(null, ZWEI) threw java.lang.NullPointerException"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
comparingValuesUsing_containsEntry_handlesException_expectedKeyHasWrongValues
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void comparingValuesUsing_containsEntry_handlesException_wrongKeyHasExpectedValue() { ListMultimap<Integer, String> actual = LinkedListMultimap.create(); actual.put(1, "one"); actual.put(3, "two"); actual.put(3, null); actual.put(3, "zwei"); AssertionError e = expectFailure( whenTesting -> whenTesting .that(actual) .comparingValuesUsing(CASE_INSENSITIVE_EQUALITY) .containsEntry(2, "ZWEI")); // The test fails and does not contain the expected key, but does contain the expected value // we the wrong key. We are bound also to hit a NPE from compare(null, ZWEI) along the way, and // should also report that. assertFailureKeys( e, "expected to contain entry", "testing whether", "but did not", "though it did contain entries with matching values", "full contents", "additionally, one or more exceptions were thrown while comparing values", "first exception"); assertThat(e) .factValue("first exception") .startsWith("compare(null, ZWEI) threw java.lang.NullPointerException"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
comparingValuesUsing_containsEntry_handlesException_wrongKeyHasExpectedValue
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void comparingValuesUsing_containsEntry_handlesException_alwaysFails() { ListMultimap<Integer, String> actual = LinkedListMultimap.create(); actual.put(1, "one"); actual.put(2, "two"); actual.put(2, null); actual.put(2, "zwei"); AssertionError e = expectFailure( whenTesting -> whenTesting .that(actual) .comparingValuesUsing(CASE_INSENSITIVE_EQUALITY) .containsEntry(2, "ZWEI")); // The multimap does contain the expected entry, but no reasonable implementation could find // it without hitting the NPE from compare(null, ZWEI) first, so we are contractually required // to fail. assertFailureKeys( e, "one or more exceptions were thrown while comparing values", "first exception", "expected to contain entry", "testing whether", "found match (but failing because of exception)", "full contents"); assertThat(e) .factValue("first exception") .startsWith("compare(null, ZWEI) threw java.lang.NullPointerException"); assertFailureValue(e, "found match (but failing because of exception)", "2=zwei"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
comparingValuesUsing_containsEntry_handlesException_alwaysFails
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0
@Test public void comparingValuesUsing_containsEntry_wrongTypeInActual() { ImmutableListMultimap<String, Object> actual = ImmutableListMultimap.of("abc", "+123", "def", "+456", "def", 789); AssertionError e = expectFailure( whenTesting -> whenTesting .that(actual) .comparingValuesUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE) .containsEntry("def", 789)); assertFailureKeys( e, "expected to contain entry", "testing whether", "but did not", "though it did contain values for that key", "full contents", "additionally, one or more exceptions were thrown while comparing values", "first exception"); assertThat(e) .factValue("first exception") .startsWith("compare(789, 789) threw java.lang.ClassCastException"); }
Tests for Multimap Subjects. @author Daniel Ploch @author Kurt Alfred Kluever
comparingValuesUsing_containsEntry_wrongTypeInActual
java
google/truth
core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/MultimapSubjectTest.java
Apache-2.0