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 testContainsAnyIn_fails() {
AssertionError unused =
expectFailure(
whenTesting -> whenTesting.that(LongStream.of(42)).containsAnyIn(asList(43, 44)));
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsAnyIn_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 testDoesNotContain() {
assertThat(LongStream.of(42)).doesNotContain(43);
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testDoesNotContain
|
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 testDoesNotContain_fails() {
AssertionError unused =
expectFailure(whenTesting -> whenTesting.that(LongStream.of(42)).doesNotContain(42));
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testDoesNotContain_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 testContainsNoneOf() {
assertThat(LongStream.of(42)).containsNoneOf(43, 44);
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsNoneOf
|
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 testContainsNoneOf_fails() {
AssertionError unused =
expectFailure(whenTesting -> whenTesting.that(LongStream.of(42)).containsNoneOf(42, 43));
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsNoneOf_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 testContainsNoneIn() {
assertThat(LongStream.of(42)).containsNoneIn(asList(43, 44));
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsNoneIn
|
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 testContainsNoneIn_fails() {
AssertionError unused =
expectFailure(
whenTesting -> whenTesting.that(LongStream.of(42)).containsNoneIn(asList(42L, 43L)));
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsNoneIn_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 testContainsAtLeast() {
assertThat(LongStream.of(42, 43)).containsAtLeast(42, 43);
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsAtLeast
|
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 testContainsAtLeast_fails() {
AssertionError unused =
expectFailure(
whenTesting -> whenTesting.that(LongStream.of(42, 43)).containsAtLeast(42, 43, 44));
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsAtLeast_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 testContainsAtLeast_inOrder() {
assertThat(LongStream.of(42, 43)).containsAtLeast(42, 43).inOrder();
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsAtLeast_inOrder
|
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 testContainsAtLeast_inOrder_fails() {
AssertionError expected =
expectFailure(
whenTesting ->
whenTesting.that(LongStream.of(42, 43)).containsAtLeast(43, 42).inOrder());
assertFailureKeys(
expected,
"required elements were all found, but order was wrong",
"expected order for required elements",
"but was");
assertFailureValue(expected, "expected order for required elements", "[43, 42]");
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsAtLeast_inOrder_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 testContainsAtLeastElementsIn() {
assertThat(LongStream.of(42, 43)).containsAtLeastElementsIn(asList(42L, 43L));
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsAtLeastElementsIn
|
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 testContainsAtLeastElementsIn_fails() {
AssertionError unused =
expectFailure(
whenTesting ->
whenTesting
.that(LongStream.of(42, 43))
.containsAtLeastElementsIn(asList(42L, 43L, 44L)));
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsAtLeastElementsIn_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 testContainsAtLeastElementsIn_wrongType_fails() {
AssertionError unused =
expectFailure(
whenTesting ->
whenTesting
.that(LongStream.of(42, 43))
.containsAtLeastElementsIn(asList(42, 43, 44)));
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsAtLeastElementsIn_wrongType_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 testContainsAtLeastElementsIn_inOrder() {
assertThat(LongStream.of(42, 43)).containsAtLeastElementsIn(asList(42L, 43L)).inOrder();
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsAtLeastElementsIn_inOrder
|
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 testContainsAtLeastElementsIn_inOrder_fails() {
AssertionError expected =
expectFailure(
whenTesting ->
whenTesting
.that(LongStream.of(42, 43))
.containsAtLeastElementsIn(asList(43L, 42L))
.inOrder());
assertFailureKeys(
expected,
"required elements were all found, but order was wrong",
"expected order for required elements",
"but was");
assertFailureValue(expected, "expected order for required elements", "[43, 42]");
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsAtLeastElementsIn_inOrder_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 testContainsAtLeastElementsIn_inOrder_wrongType_fails() {
AssertionError unused =
expectFailure(
whenTesting ->
whenTesting
.that(LongStream.of(42, 43))
.containsAtLeastElementsIn(asList(43, 42))
.inOrder());
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsAtLeastElementsIn_inOrder_wrongType_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 testContainsExactly() {
assertThat(LongStream.of(42, 43)).containsExactly(42, 43);
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsExactly
|
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 testContainsExactly_fails() {
AssertionError expected =
expectFailure(whenTesting -> whenTesting.that(LongStream.of(42, 43)).containsExactly(42));
assertFailureKeys(expected, "unexpected (1)", "---", "expected", "but was");
assertFailureValue(expected, "expected", "[42]");
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsExactly_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 testContainsExactly_inOrder() {
assertThat(LongStream.of(42, 43)).containsExactly(42, 43).inOrder();
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsExactly_inOrder
|
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 testContainsExactly_inOrder_fails() {
AssertionError expected =
expectFailure(
whenTesting ->
whenTesting.that(LongStream.of(42, 43)).containsExactly(43, 42).inOrder());
assertFailureKeys(expected, "contents match, but order was wrong", "expected", "but was");
assertFailureValue(expected, "expected", "[43, 42]");
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsExactly_inOrder_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 testContainsExactlyElementsIn() {
assertThat(LongStream.of(42, 43)).containsExactlyElementsIn(asList(42L, 43L));
assertThat(LongStream.of(42, 43)).containsExactlyElementsIn(asList(43L, 42L));
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsExactlyElementsIn
|
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 testContainsExactlyElementsIn_fails() {
AssertionError expected =
expectFailure(
whenTesting ->
whenTesting.that(LongStream.of(42, 43)).containsExactlyElementsIn(asList(42L)));
assertFailureKeys(expected, "unexpected (1)", "---", "expected", "but was");
assertFailureValue(expected, "expected", "[42]");
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsExactlyElementsIn_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 testContainsExactlyElementsIn_wrongType_fails() {
AssertionError unused =
expectFailure(
whenTesting ->
whenTesting.that(LongStream.of(42, 43)).containsExactlyElementsIn(asList(42)));
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsExactlyElementsIn_wrongType_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 testContainsExactlyElementsIn_inOrder() {
assertThat(LongStream.of(42, 43)).containsExactlyElementsIn(asList(42L, 43L)).inOrder();
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsExactlyElementsIn_inOrder
|
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 testContainsExactlyElementsIn_inOrder_fails() {
AssertionError expected =
expectFailure(
whenTesting ->
whenTesting
.that(LongStream.of(42, 43))
.containsExactlyElementsIn(asList(43L, 42L))
.inOrder());
assertFailureKeys(expected, "contents match, but order was wrong", "expected", "but was");
assertFailureValue(expected, "expected", "[43, 42]");
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsExactlyElementsIn_inOrder_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 testContainsExactlyElementsIn_inOrder_wrongType_fails() {
AssertionError unused =
expectFailure(
whenTesting ->
whenTesting
.that(LongStream.of(42, 43))
.containsExactlyElementsIn(asList(43, 42))
.inOrder());
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsExactlyElementsIn_inOrder_wrongType_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 testContainsExactlyElementsIn_inOrder_LongStream() {
assertThat(LongStream.of(1, 2, 3, 4)).containsExactly(1, 2, 3, 4).inOrder();
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testContainsExactlyElementsIn_inOrder_LongStream
|
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 testIsInOrder() {
assertThat(LongStream.of()).isInOrder();
assertThat(LongStream.of(1)).isInOrder();
assertThat(LongStream.of(1, 1, 2, 3, 3, 3, 4)).isInOrder();
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testIsInOrder
|
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 testIsInOrder_fails() {
AssertionError unused =
expectFailure(whenTesting -> whenTesting.that(LongStream.of(1, 3, 2, 4)).isInOrder());
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testIsInOrder_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 testIsInStrictOrder() {
assertThat(LongStream.of()).isInStrictOrder();
assertThat(LongStream.of(1)).isInStrictOrder();
assertThat(LongStream.of(1, 2, 3, 4)).isInStrictOrder();
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testIsInStrictOrder
|
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 testIsInStrictOrder_fails() {
AssertionError unused =
expectFailure(whenTesting -> whenTesting.that(LongStream.of(1, 2, 2, 4)).isInStrictOrder());
}
|
Tests for {@link LongStream} Subjects.
@author Kurt Alfred Kluever
|
testIsInStrictOrder_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
@SuppressWarnings("TruthSelfEquals")
public void simpleEquality() {
assertThat(4L).isEqualTo(4L);
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
simpleEquality
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void simpleInequality() {
assertThat(4L).isNotEqualTo(5L);
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
simpleInequality
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void equalityWithInts() {
assertThat(0L).isEqualTo(0);
expectFailure(whenTesting -> whenTesting.that(0L).isNotEqualTo(0));
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
equalityWithInts
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void equalityFail() {
expectFailure(whenTesting -> whenTesting.that(4L).isEqualTo(5L));
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
equalityFail
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@SuppressWarnings("SelfAssertion")
@Test
public void inequalityFail() {
expectFailure(whenTesting -> whenTesting.that(4L).isNotEqualTo(4L));
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
inequalityFail
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void equalityOfNulls() {
assertThat((Long) null).isEqualTo(null);
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
equalityOfNulls
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void equalityOfNullsFail_nullActual() {
expectFailure(whenTesting -> whenTesting.that((Long) null).isEqualTo(5L));
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
equalityOfNullsFail_nullActual
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void equalityOfNullsFail_nullExpected() {
expectFailure(whenTesting -> whenTesting.that(5L).isEqualTo(null));
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
equalityOfNullsFail_nullExpected
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void inequalityOfNulls() {
assertThat(4L).isNotEqualTo(null);
assertThat((Integer) null).isNotEqualTo(4L);
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
inequalityOfNulls
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void inequalityOfNullsFail() {
expectFailure(whenTesting -> whenTesting.that((Long) null).isNotEqualTo(null));
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
inequalityOfNullsFail
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@SuppressWarnings("SelfAssertion")
@Test
public void testNumericTypeWithSameValue_shouldBeEqual_long_long() {
expectFailure(whenTesting -> whenTesting.that(42L).isNotEqualTo(42L));
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
testNumericTypeWithSameValue_shouldBeEqual_long_long
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void testNumericTypeWithSameValue_shouldBeEqual_long_int() {
expectFailure(whenTesting -> whenTesting.that(42L).isNotEqualTo(42));
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
testNumericTypeWithSameValue_shouldBeEqual_long_int
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void isGreaterThan_int_strictly() {
expectFailure(whenTesting -> whenTesting.that(2L).isGreaterThan(3));
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
isGreaterThan_int_strictly
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void isGreaterThan_int() {
expectFailure(whenTesting -> whenTesting.that(2L).isGreaterThan(2));
assertThat(2L).isGreaterThan(1);
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
isGreaterThan_int
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void isLessThan_int_strictly() {
expectFailure(whenTesting -> whenTesting.that(2L).isLessThan(1));
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
isLessThan_int_strictly
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void isLessThan_int() {
expectFailure(whenTesting -> whenTesting.that(2L).isLessThan(2));
assertThat(2L).isLessThan(3);
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
isLessThan_int
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void isAtLeast_int() {
expectFailure(whenTesting -> whenTesting.that(2L).isAtLeast(3));
assertThat(2L).isAtLeast(2);
assertThat(2L).isAtLeast(1);
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
isAtLeast_int
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void isAtMost_int() {
expectFailure(whenTesting -> whenTesting.that(2L).isAtMost(1));
assertThat(2L).isAtMost(2);
assertThat(2L).isAtMost(3);
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
isAtMost_int
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void isWithinOf() {
assertThat(20000L).isWithin(0L).of(20000L);
assertThat(20000L).isWithin(1L).of(20000L);
assertThat(20000L).isWithin(10000L).of(20000L);
assertThat(20000L).isWithin(10000L).of(30000L);
assertThat(Long.MIN_VALUE).isWithin(1L).of(Long.MIN_VALUE + 1);
assertThat(Long.MAX_VALUE).isWithin(1L).of(Long.MAX_VALUE - 1);
assertThat(Long.MAX_VALUE / 2).isWithin(Long.MAX_VALUE).of(-Long.MAX_VALUE / 2);
assertThat(-Long.MAX_VALUE / 2).isWithin(Long.MAX_VALUE).of(Long.MAX_VALUE / 2);
assertThatIsWithinFails(20000L, 9999L, 30000L);
assertThatIsWithinFails(20000L, 10000L, 30001L);
assertThatIsWithinFails(Long.MIN_VALUE, 0L, Long.MAX_VALUE);
assertThatIsWithinFails(Long.MAX_VALUE, 0L, Long.MIN_VALUE);
assertThatIsWithinFails(Long.MIN_VALUE, 1L, Long.MIN_VALUE + 2);
assertThatIsWithinFails(Long.MAX_VALUE, 1L, Long.MAX_VALUE - 2);
// Don't fall for rollover
assertThatIsWithinFails(Long.MIN_VALUE, 1L, Long.MAX_VALUE);
assertThatIsWithinFails(Long.MAX_VALUE, 1L, Long.MIN_VALUE);
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
isWithinOf
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
private static void assertThatIsWithinFails(long actual, long tolerance, long expected) {
AssertionError failure =
expectFailure(whenTesting -> whenTesting.that(actual).isWithin(tolerance).of(expected));
assertThat(failure)
.factKeys()
.containsExactly("expected", "but was", "outside tolerance")
.inOrder();
assertThat(failure).factValue("expected").isEqualTo(formatNumericValue(expected));
assertThat(failure).factValue("but was").isEqualTo(formatNumericValue(actual));
assertThat(failure).factValue("outside tolerance").isEqualTo(formatNumericValue(tolerance));
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
assertThatIsWithinFails
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void isNotWithinOf() {
assertThatIsNotWithinFails(20000L, 0L, 20000L);
assertThatIsNotWithinFails(20000L, 1L, 20000L);
assertThatIsNotWithinFails(20000L, 10000L, 20000L);
assertThatIsNotWithinFails(20000L, 10000L, 30000L);
assertThatIsNotWithinFails(Long.MIN_VALUE, 1L, Long.MIN_VALUE + 1);
assertThatIsNotWithinFails(Long.MAX_VALUE, 1L, Long.MAX_VALUE - 1);
assertThatIsNotWithinFails(Long.MAX_VALUE / 2, Long.MAX_VALUE, -Long.MAX_VALUE / 2);
assertThatIsNotWithinFails(-Long.MAX_VALUE / 2, Long.MAX_VALUE, Long.MAX_VALUE / 2);
assertThat(20000L).isNotWithin(9999L).of(30000L);
assertThat(20000L).isNotWithin(10000L).of(30001L);
assertThat(Long.MIN_VALUE).isNotWithin(0L).of(Long.MAX_VALUE);
assertThat(Long.MAX_VALUE).isNotWithin(0L).of(Long.MIN_VALUE);
assertThat(Long.MIN_VALUE).isNotWithin(1L).of(Long.MIN_VALUE + 2);
assertThat(Long.MAX_VALUE).isNotWithin(1L).of(Long.MAX_VALUE - 2);
// Don't fall for rollover
assertThat(Long.MIN_VALUE).isNotWithin(1L).of(Long.MAX_VALUE);
assertThat(Long.MAX_VALUE).isNotWithin(1L).of(Long.MIN_VALUE);
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
isNotWithinOf
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
private static void assertThatIsNotWithinFails(long actual, long tolerance, long expected) {
AssertionError failure =
expectFailure(whenTesting -> whenTesting.that(actual).isNotWithin(tolerance).of(expected));
assertThat(failure).factValue("expected not to be").isEqualTo(formatNumericValue(expected));
assertThat(failure).factValue("within tolerance").isEqualTo(formatNumericValue(tolerance));
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
assertThatIsNotWithinFails
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void isWithinIntegers() {
assertThat(20000L).isWithin(0).of(20000);
assertThat(20000L).isWithin(1).of(20000);
assertThat(20000L).isWithin(10000).of(20000);
assertThat(20000L).isWithin(10000).of(30000);
assertThat(20000L).isNotWithin(0).of(200000);
assertThat(20000L).isNotWithin(1).of(200000);
assertThat(20000L).isNotWithin(10000).of(200000);
assertThat(20000L).isNotWithin(10000).of(300000);
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
isWithinIntegers
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void isWithinNegativeTolerance() {
isWithinNegativeToleranceThrows(0L, -10, 0L);
isWithinNegativeToleranceThrows(0L, -10, 0L);
isNotWithinNegativeToleranceThrows(0L, -10, 0L);
isNotWithinNegativeToleranceThrows(0L, -10, 0L);
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
isWithinNegativeTolerance
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
private static void isWithinNegativeToleranceThrows(long actual, long tolerance, long expected) {
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(actual).isWithin(tolerance).of(expected));
assertFailureKeys(
e,
"could not perform approximate-equality check because tolerance is negative",
"expected",
"was",
"tolerance");
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
isWithinNegativeToleranceThrows
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
private static void isNotWithinNegativeToleranceThrows(
long actual, long tolerance, long expected) {
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(actual).isNotWithin(tolerance).of(expected));
assertFailureKeys(
e,
"could not perform approximate-equality check because tolerance is negative",
"expected",
"was",
"tolerance");
}
|
Tests for Long Subjects.
@author David Saff
@author Christian Gruber
@author Kurt Alfred Kluever
|
isNotWithinNegativeToleranceThrows
|
java
|
google/truth
|
core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
https://github.com/google/truth/blob/master/core/src/test/java/com/google/common/truth/LongSubjectTest.java
|
Apache-2.0
|
@Test
public void containsExactlyWithNullKey() {
Map<String, String> actual = new HashMap<>();
actual.put(null, "value");
assertThat(actual).containsExactly(null, "value");
assertThat(actual).containsExactly(null, "value").inOrder();
assertThat(actual).containsExactlyEntriesIn(actual);
assertThat(actual).containsExactlyEntriesIn(actual).inOrder();
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyWithNullKey
|
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 containsExactlyWithNullValue() {
Map<String, String> actual = new HashMap<>();
actual.put("key", null);
assertThat(actual).containsExactly("key", null);
assertThat(actual).containsExactly("key", null).inOrder();
assertThat(actual).containsExactlyEntriesIn(actual);
assertThat(actual).containsExactlyEntriesIn(actual).inOrder();
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyWithNullValue
|
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 containsExactlyEmpty() {
ImmutableMap<String, Integer> actual = ImmutableMap.of();
assertThat(actual).containsExactly();
assertThat(actual).containsExactly().inOrder();
assertThat(actual).containsExactlyEntriesIn(actual);
assertThat(actual).containsExactlyEntriesIn(actual).inOrder();
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyEmpty
|
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 containsExactlyEmpty_fails() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1);
AssertionError e = expectFailure(whenTesting -> whenTesting.that(actual).containsExactly());
assertFailureKeys(e, "expected to be empty", "but was");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyEmpty_fails
|
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 containsExactlyEntriesInEmpty_fails() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1);
AssertionError e =
expectFailure(
whenTesting -> whenTesting.that(actual).containsExactlyEntriesIn(ImmutableMap.of()));
assertFailureKeys(e, "expected to be empty", "but was");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyEntriesInEmpty_fails
|
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 containsExactlyOneEntry() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1);
assertThat(actual).containsExactly("jan", 1);
assertThat(actual).containsExactly("jan", 1).inOrder();
assertThat(actual).containsExactlyEntriesIn(actual);
assertThat(actual).containsExactlyEntriesIn(actual).inOrder();
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyOneEntry
|
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 containsExactlyMultipleEntries() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2, "march", 3);
assertThat(actual).containsExactly("march", 3, "jan", 1, "feb", 2);
assertThat(actual).containsExactly("jan", 1, "feb", 2, "march", 3).inOrder();
assertThat(actual).containsExactlyEntriesIn(actual);
assertThat(actual).containsExactlyEntriesIn(actual).inOrder();
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyMultipleEntries
|
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 containsExactlyDuplicateKeys() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2, "march", 3);
IllegalArgumentException expected =
assertThrows(
IllegalArgumentException.class,
() -> assertThat(actual).containsExactly("jan", 1, "jan", 2, "jan", 3));
assertThat(expected)
.hasMessageThat()
.isEqualTo("Duplicate keys ([jan x 3]) cannot be passed to containsExactly().");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyDuplicateKeys
|
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 containsExactlyMultipleDuplicateKeys() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2, "march", 3);
IllegalArgumentException expected =
assertThrows(
IllegalArgumentException.class,
() -> assertThat(actual).containsExactly("jan", 1, "jan", 1, "feb", 2, "feb", 2));
assertThat(expected)
.hasMessageThat()
.isEqualTo("Duplicate keys ([jan x 2, feb x 2]) cannot be passed to containsExactly().");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyMultipleDuplicateKeys
|
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 containsExactlyExtraKey() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2, "march", 3);
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(actual).containsExactly("feb", 2, "jan", 1));
assertFailureKeys(
e, "unexpected keys", "for key", "unexpected value", "---", "expected", "but was");
assertFailureValue(e, "for key", "march");
assertFailureValue(e, "unexpected value", "3");
assertFailureValue(e, "expected", "{feb=2, jan=1}");
assertFailureValue(e, "but was", "{jan=1, feb=2, march=3}");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyExtraKey
|
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 containsExactlyExtraKeyInOrder() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2, "march", 3);
AssertionError e =
expectFailure(
whenTesting -> whenTesting.that(actual).containsExactly("feb", 2, "jan", 1).inOrder());
assertFailureKeys(
e, "unexpected keys", "for key", "unexpected value", "---", "expected", "but was");
assertFailureValue(e, "for key", "march");
assertFailureValue(e, "unexpected value", "3");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyExtraKeyInOrder
|
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 containsExactlyMissingKey() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2);
AssertionError e =
expectFailure(
whenTesting ->
whenTesting.that(actual).containsExactly("jan", 1, "march", 3, "feb", 2));
assertFailureKeys(e, "missing keys", "for key", "expected value", "---", "expected", "but was");
assertFailureValue(e, "for key", "march");
assertFailureValue(e, "expected value", "3");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyMissingKey
|
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 containsExactlyWrongValue() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2, "march", 3);
AssertionError e =
expectFailure(
whenTesting ->
whenTesting.that(actual).containsExactly("jan", 1, "march", 33, "feb", 2));
assertFailureKeys(
e,
"keys with wrong values",
"for key",
"expected value",
"but got value",
"---",
"expected",
"but was");
assertFailureValue(e, "for key", "march");
assertFailureValue(e, "expected value", "33");
assertFailureValue(e, "but got value", "3");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyWrongValue
|
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 containsExactlyWrongValueWithNull() {
// Test for https://github.com/google/truth/issues/468
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2, "march", 3);
AssertionError e =
expectFailure(
whenTesting ->
whenTesting.that(actual).containsExactly("jan", 1, "march", null, "feb", 2));
assertFailureKeys(
e,
"keys with wrong values",
"for key",
"expected value",
"but got value",
"---",
"expected",
"but was");
assertFailureValue(e, "for key", "march");
assertFailureValue(e, "expected value", "null");
assertFailureValue(e, "but got value", "3");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyWrongValueWithNull
|
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 containsExactlyExtraKeyAndMissingKey() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "march", 3);
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(actual).containsExactly("jan", 1, "feb", 2));
assertFailureKeys(
e,
"missing keys",
"for key",
"expected value",
"unexpected keys",
"for key",
"unexpected value",
"---",
"expected",
"but was");
assertFailureValueIndexed(e, "for key", 0, "feb");
assertFailureValue(e, "expected value", "2");
assertFailureValueIndexed(e, "for key", 1, "march");
assertFailureValue(e, "unexpected value", "3");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyExtraKeyAndMissingKey
|
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 containsExactlyExtraKeyAndWrongValue() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2, "march", 3);
AssertionError e =
expectFailure(
whenTesting -> whenTesting.that(actual).containsExactly("jan", 1, "march", 33));
assertFailureKeys(
e,
"keys with wrong values",
"for key",
"expected value",
"but got value",
"unexpected keys",
"for key",
"unexpected value",
"---",
"expected",
"but was");
assertFailureValueIndexed(e, "for key", 0, "march");
assertFailureValue(e, "expected value", "33");
assertFailureValue(e, "but got value", "3");
assertFailureValueIndexed(e, "for key", 1, "feb");
assertFailureValue(e, "unexpected value", "2");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyExtraKeyAndWrongValue
|
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 containsExactlyMissingKeyAndWrongValue() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "march", 3);
AssertionError e =
expectFailure(
whenTesting ->
whenTesting.that(actual).containsExactly("jan", 1, "march", 33, "feb", 2));
assertFailureKeys(
e,
"keys with wrong values",
"for key",
"expected value",
"but got value",
"missing keys",
"for key",
"expected value",
"---",
"expected",
"but was");
assertFailureValueIndexed(e, "for key", 0, "march");
assertFailureValueIndexed(e, "expected value", 0, "33");
assertFailureValue(e, "but got value", "3");
assertFailureValueIndexed(e, "for key", 1, "feb");
assertFailureValueIndexed(e, "expected value", 1, "2");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyMissingKeyAndWrongValue
|
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 containsExactlyExtraKeyAndMissingKeyAndWrongValue() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "march", 3);
AssertionError e =
expectFailure(
whenTesting -> whenTesting.that(actual).containsExactly("march", 33, "feb", 2));
assertFailureKeys(
e,
"keys with wrong values",
"for key",
"expected value",
"but got value",
"missing keys",
"for key",
"expected value",
"unexpected keys",
"for key",
"unexpected value",
"---",
"expected",
"but was");
assertFailureValueIndexed(e, "for key", 0, "march");
assertFailureValueIndexed(e, "expected value", 0, "33");
assertFailureValue(e, "but got value", "3");
assertFailureValueIndexed(e, "for key", 1, "feb");
assertFailureValueIndexed(e, "expected value", 1, "2");
assertFailureValueIndexed(e, "for key", 2, "jan");
assertFailureValue(e, "unexpected value", "1");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyExtraKeyAndMissingKeyAndWrongValue
|
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 containsExactlyNotInOrder() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2, "march", 3);
assertThat(actual).containsExactlyEntriesIn(actual);
assertThat(actual).containsExactlyEntriesIn(actual).inOrder();
assertThat(actual).containsExactly("jan", 1, "march", 3, "feb", 2);
AssertionError e =
expectFailure(
whenTesting ->
whenTesting.that(actual).containsExactly("jan", 1, "march", 3, "feb", 2).inOrder());
assertFailureKeys(e, "entries match, but order was wrong", "expected", "but was");
assertFailureValue(e, "expected", "{jan=1, march=3, feb=2}");
assertFailureValue(e, "but was", "{jan=1, feb=2, march=3}");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyNotInOrder
|
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
@SuppressWarnings("ShouldHaveEvenArgs")
public void containsExactlyBadNumberOfArgs() {
ImmutableMap<String, Integer> actual =
ImmutableMap.of("jan", 1, "feb", 2, "march", 3, "april", 4, "may", 5);
assertThat(actual).containsExactlyEntriesIn(actual);
assertThat(actual).containsExactlyEntriesIn(actual).inOrder();
IllegalArgumentException expected =
assertThrows(
IllegalArgumentException.class,
() ->
assertThat(actual)
.containsExactly(
"jan", 1, "feb", 2, "march", 3, "april", 4, "may", 5, "june", 6, "july"));
assertThat(expected)
.hasMessageThat()
.isEqualTo(
"There must be an equal number of key/value pairs "
+ "(i.e., the number of key/value parameters (13) must be even).");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyBadNumberOfArgs
|
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 containsExactlyWrongValue_sameToStringForValues() {
AssertionError e =
expectFailure(
whenTesting ->
whenTesting
.that(ImmutableMap.of("jan", 1L, "feb", 2L))
.containsExactly("jan", 1, "feb", 2));
assertFailureKeys(
e,
"keys with wrong values",
"for key",
"expected value",
"but got value",
"for key",
"expected value",
"but got value",
"---",
"expected",
"but was");
assertFailureValueIndexed(e, "for key", 0, "jan");
assertFailureValueIndexed(e, "expected value", 0, "1 (java.lang.Integer)");
assertFailureValueIndexed(e, "but got value", 0, "1 (java.lang.Long)");
assertFailureValueIndexed(e, "for key", 1, "feb");
assertFailureValueIndexed(e, "expected value", 1, "2 (java.lang.Integer)");
assertFailureValueIndexed(e, "but got value", 1, "2 (java.lang.Long)");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyWrongValue_sameToStringForValues
|
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 containsExactlyWrongValue_sameToStringForKeys() {
AssertionError e =
expectFailure(
whenTesting ->
whenTesting
.that(ImmutableMap.of(1L, "jan", 1, "feb"))
.containsExactly(1, "jan", 1L, "feb"));
assertFailureKeys(
e,
"keys with wrong values",
"for key",
"expected value",
"but got value",
"for key",
"expected value",
"but got value",
"---",
"expected",
"but was");
assertFailureValueIndexed(e, "for key", 0, "1 (java.lang.Integer)");
assertFailureValueIndexed(e, "expected value", 0, "jan");
assertFailureValueIndexed(e, "but got value", 0, "feb");
assertFailureValueIndexed(e, "for key", 1, "1 (java.lang.Long)");
assertFailureValueIndexed(e, "expected value", 1, "feb");
assertFailureValueIndexed(e, "but got value", 1, "jan");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyWrongValue_sameToStringForKeys
|
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 containsExactlyExtraKeyAndMissingKey_failsWithSameToStringForKeys() {
AssertionError e =
expectFailure(
whenTesting ->
whenTesting
.that(ImmutableMap.of(1L, "jan", 2, "feb"))
.containsExactly(1, "jan", 2, "feb"));
assertFailureKeys(
e,
"missing keys",
"for key",
"expected value",
"unexpected keys",
"for key",
"unexpected value",
"---",
"expected",
"but was");
assertFailureValueIndexed(e, "for key", 0, "1 (java.lang.Integer)");
assertFailureValue(e, "expected value", "jan");
assertFailureValueIndexed(e, "for key", 1, "1 (java.lang.Long)");
assertFailureValue(e, "unexpected value", "jan");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsExactlyExtraKeyAndMissingKey_failsWithSameToStringForKeys
|
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 containsAtLeastWithNullKey() {
Map<String, String> actual = new HashMap<>();
actual.put(null, "value");
actual.put("unexpectedKey", "unexpectedValue");
Map<String, String> expected = new HashMap<>();
expected.put(null, "value");
assertThat(actual).containsAtLeast(null, "value");
assertThat(actual).containsAtLeast(null, "value").inOrder();
assertThat(actual).containsAtLeastEntriesIn(expected);
assertThat(actual).containsAtLeastEntriesIn(expected).inOrder();
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsAtLeastWithNullKey
|
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 containsAtLeastWithNullValue() {
Map<String, String> actual = new HashMap<>();
actual.put("key", null);
actual.put("unexpectedKey", "unexpectedValue");
Map<String, String> expected = new HashMap<>();
expected.put("key", null);
assertThat(actual).containsAtLeast("key", null);
assertThat(actual).containsAtLeast("key", null).inOrder();
assertThat(actual).containsAtLeastEntriesIn(expected);
assertThat(actual).containsAtLeastEntriesIn(expected).inOrder();
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsAtLeastWithNullValue
|
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 containsAtLeastEmpty() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("key", 1);
assertThat(actual).containsAtLeastEntriesIn(ImmutableMap.of());
assertThat(actual).containsAtLeastEntriesIn(ImmutableMap.of()).inOrder();
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsAtLeastEmpty
|
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 containsAtLeastOneEntry() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1);
assertThat(actual).containsAtLeast("jan", 1);
assertThat(actual).containsAtLeast("jan", 1).inOrder();
assertThat(actual).containsAtLeastEntriesIn(actual);
assertThat(actual).containsAtLeastEntriesIn(actual).inOrder();
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsAtLeastOneEntry
|
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 containsAtLeastMultipleEntries() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2, "mar", 3, "apr", 4);
assertThat(actual).containsAtLeast("apr", 4, "jan", 1, "feb", 2);
assertThat(actual).containsAtLeast("jan", 1, "feb", 2, "apr", 4).inOrder();
assertThat(actual).containsAtLeastEntriesIn(ImmutableMap.of("apr", 4, "jan", 1, "feb", 2));
assertThat(actual).containsAtLeastEntriesIn(actual).inOrder();
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsAtLeastMultipleEntries
|
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 containsAtLeastDuplicateKeys() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2, "march", 3);
IllegalArgumentException expected =
assertThrows(
IllegalArgumentException.class,
() -> assertThat(actual).containsAtLeast("jan", 1, "jan", 2, "jan", 3));
assertThat(expected)
.hasMessageThat()
.isEqualTo("Duplicate keys ([jan x 3]) cannot be passed to containsAtLeast().");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsAtLeastDuplicateKeys
|
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 containsAtLeastMultipleDuplicateKeys() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2, "march", 3);
IllegalArgumentException expected =
assertThrows(
IllegalArgumentException.class,
() -> assertThat(actual).containsAtLeast("jan", 1, "jan", 1, "feb", 2, "feb", 2));
assertThat(expected)
.hasMessageThat()
.isEqualTo("Duplicate keys ([jan x 2, feb x 2]) cannot be passed to containsAtLeast().");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsAtLeastMultipleDuplicateKeys
|
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 containsAtLeastMissingKey() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2);
AssertionError e =
expectFailure(
whenTesting -> whenTesting.that(actual).containsAtLeast("jan", 1, "march", 3));
assertFailureKeys(
e,
"missing keys",
"for key",
"expected value",
"---",
"expected to contain at least",
"but was");
assertFailureValue(e, "for key", "march");
assertFailureValue(e, "expected value", "3");
assertFailureValue(e, "expected to contain at least", "{jan=1, march=3}");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsAtLeastMissingKey
|
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 containsAtLeastWrongValue() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2, "march", 3);
AssertionError e =
expectFailure(
whenTesting -> whenTesting.that(actual).containsAtLeast("jan", 1, "march", 33));
assertFailureKeys(
e,
"keys with wrong values",
"for key",
"expected value",
"but got value",
"---",
"expected to contain at least",
"but was");
assertFailureValue(e, "for key", "march");
assertFailureValue(e, "expected value", "33");
assertFailureValue(e, "but got value", "3");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsAtLeastWrongValue
|
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 containsAtLeastWrongValueWithNull() {
// Test for https://github.com/google/truth/issues/468
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2, "march", 3);
AssertionError e =
expectFailure(
whenTesting -> whenTesting.that(actual).containsAtLeast("jan", 1, "march", null));
assertFailureKeys(
e,
"keys with wrong values",
"for key",
"expected value",
"but got value",
"---",
"expected to contain at least",
"but was");
assertFailureValue(e, "for key", "march");
assertFailureValue(e, "expected value", "null");
assertFailureValue(e, "but got value", "3");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsAtLeastWrongValueWithNull
|
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 containsAtLeastExtraKeyAndMissingKeyAndWrongValue() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "march", 3);
AssertionError e =
expectFailure(
whenTesting -> whenTesting.that(actual).containsAtLeast("march", 33, "feb", 2));
assertFailureKeys(
e,
"keys with wrong values",
"for key",
"expected value",
"but got value",
"missing keys",
"for key",
"expected value",
"---",
"expected to contain at least",
"but was");
assertFailureValueIndexed(e, "for key", 0, "march");
assertFailureValueIndexed(e, "expected value", 0, "33");
assertFailureValue(e, "but got value", "3");
assertFailureValueIndexed(e, "for key", 1, "feb");
assertFailureValueIndexed(e, "expected value", 1, "2");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsAtLeastExtraKeyAndMissingKeyAndWrongValue
|
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 containsAtLeastNotInOrder() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2, "march", 3);
assertThat(actual).containsAtLeast("march", 3, "feb", 2);
AssertionError e =
expectFailure(
whenTesting ->
whenTesting.that(actual).containsAtLeast("march", 3, "feb", 2).inOrder());
assertFailureKeys(
e,
"required entries were all found, but order was wrong",
"expected to contain at least",
"but was");
assertFailureValue(e, "expected to contain at least", "{march=3, feb=2}");
assertFailureValue(e, "but was", "{jan=1, feb=2, march=3}");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsAtLeastNotInOrder
|
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
@SuppressWarnings("ShouldHaveEvenArgs")
public void containsAtLeastBadNumberOfArgs() {
ImmutableMap<String, Integer> actual =
ImmutableMap.of("jan", 1, "feb", 2, "march", 3, "april", 4, "may", 5);
IllegalArgumentException expected =
assertThrows(
IllegalArgumentException.class,
() ->
assertThat(actual)
.containsAtLeast(
"jan", 1, "feb", 2, "march", 3, "april", 4, "may", 5, "june", 6, "july"));
assertThat(expected)
.hasMessageThat()
.isEqualTo(
"There must be an equal number of key/value pairs "
+ "(i.e., the number of key/value parameters (13) must be even).");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsAtLeastBadNumberOfArgs
|
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 containsAtLeastWrongValue_sameToStringForValues() {
AssertionError e =
expectFailure(
whenTesting ->
whenTesting
.that(ImmutableMap.of("jan", 1L, "feb", 2L, "mar", 3L))
.containsAtLeast("jan", 1, "feb", 2));
assertFailureKeys(
e,
"keys with wrong values",
"for key",
"expected value",
"but got value",
"for key",
"expected value",
"but got value",
"---",
"expected to contain at least",
"but was");
assertFailureValueIndexed(e, "for key", 0, "jan");
assertFailureValueIndexed(e, "expected value", 0, "1 (java.lang.Integer)");
assertFailureValueIndexed(e, "but got value", 0, "1 (java.lang.Long)");
assertFailureValueIndexed(e, "for key", 1, "feb");
assertFailureValueIndexed(e, "expected value", 1, "2 (java.lang.Integer)");
assertFailureValueIndexed(e, "but got value", 1, "2 (java.lang.Long)");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsAtLeastWrongValue_sameToStringForValues
|
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 containsAtLeastWrongValue_sameToStringForKeys() {
AssertionError e =
expectFailure(
whenTesting ->
whenTesting
.that(ImmutableMap.of(1L, "jan", 1, "feb"))
.containsAtLeast(1, "jan", 1L, "feb"));
assertFailureKeys(
e,
"keys with wrong values",
"for key",
"expected value",
"but got value",
"for key",
"expected value",
"but got value",
"---",
"expected to contain at least",
"but was");
assertFailureValueIndexed(e, "for key", 0, "1 (java.lang.Integer)");
assertFailureValueIndexed(e, "expected value", 0, "jan");
assertFailureValueIndexed(e, "but got value", 0, "feb");
assertFailureValueIndexed(e, "for key", 1, "1 (java.lang.Long)");
assertFailureValueIndexed(e, "expected value", 1, "feb");
assertFailureValueIndexed(e, "but got value", 1, "jan");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsAtLeastWrongValue_sameToStringForKeys
|
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 containsAtLeastExtraKeyAndMissingKey_failsWithSameToStringForKeys() {
AssertionError e =
expectFailure(
whenTesting ->
whenTesting
.that(ImmutableMap.of(1L, "jan", 2, "feb"))
.containsAtLeast(1, "jan", 2, "feb"));
assertFailureKeys(
e,
"missing keys",
"for key",
"expected value",
"---",
"expected to contain at least",
"but was");
assertFailureValue(e, "for key", "1 (java.lang.Integer)");
assertFailureValue(e, "expected value", "jan");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
containsAtLeastExtraKeyAndMissingKey_failsWithSameToStringForKeys
|
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 isEqualToPass() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2, "march", 3);
ImmutableMap<String, Integer> expectedMap = ImmutableMap.of("jan", 1, "feb", 2, "march", 3);
assertThat(actual).isEqualTo(expectedMap);
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
isEqualToPass
|
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 isEqualToFailureExtraMissingAndDiffering() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2, "march", 3);
ImmutableMap<String, Integer> expectedMap = ImmutableMap.of("jan", 1, "april", 4, "march", 5);
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(actual).isEqualTo(expectedMap));
assertFailureKeys(
e,
"keys with wrong values",
"for key",
"expected value",
"but got value",
"missing keys",
"for key",
"expected value",
"unexpected keys",
"for key",
"unexpected value",
"---",
"expected",
"but was");
assertFailureValueIndexed(e, "for key", 0, "march");
assertFailureValueIndexed(e, "expected value", 0, "5");
assertFailureValue(e, "but got value", "3");
assertFailureValueIndexed(e, "for key", 1, "april");
assertFailureValueIndexed(e, "expected value", 1, "4");
assertFailureValueIndexed(e, "for key", 2, "feb");
assertFailureValue(e, "unexpected value", "2");
assertFailureValue(e, "expected", "{jan=1, april=4, march=5}");
assertFailureValue(e, "but was", "{jan=1, feb=2, march=3}");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
isEqualToFailureExtraMissingAndDiffering
|
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 isEqualToFailureDiffering() {
ImmutableMap<String, Integer> actual = ImmutableMap.of("jan", 1, "feb", 2, "march", 3);
ImmutableMap<String, Integer> expectedMap = ImmutableMap.of("jan", 1, "feb", 2, "march", 4);
AssertionError e =
expectFailure(whenTesting -> whenTesting.that(actual).isEqualTo(expectedMap));
assertFailureKeys(
e,
"keys with wrong values",
"for key",
"expected value",
"but got value",
"---",
"expected",
"but was");
assertFailureValueIndexed(e, "for key", 0, "march");
assertFailureValue(e, "expected value", "4");
assertFailureValue(e, "but got value", "3");
}
|
Tests for {@link Map} subjects.
@author Christian Gruber
@author Kurt Alfred Kluever
|
isEqualToFailureDiffering
|
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
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.