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 testIterableFieldScopeMethodVariants_multimapWithProtoValuesSubject() { ImmutableMultimap<String, Message> messages = ImmutableMultimap.of("foo", parse("o_int: 1 r_string: \"foo\"")); ImmutableMultimap<String, Message> eqExceptInt = ImmutableMultimap.of("foo", parse("o_int: 2 r_string: \"foo\"")); expectThat(messages) .ignoringFieldsForValues(listOf(getFieldNumber("o_int"))) .containsExactlyEntriesIn(eqExceptInt); expectThat(messages) .reportingMismatchesOnlyForValues() .ignoringFieldsForValues(listOf(getFieldNumber("o_int"))) .containsExactlyEntriesIn(eqExceptInt); expectThat(messages) .ignoringFieldDescriptorsForValues(listOf(getFieldDescriptor("o_int"))) .containsExactlyEntriesIn(eqExceptInt); expectThat(messages) .reportingMismatchesOnlyForValues() .ignoringFieldDescriptorsForValues(listOf(getFieldDescriptor("o_int"))) .containsExactlyEntriesIn(eqExceptInt); }
Unit tests for {@link FieldScope}, and their interaction with {@link ProtoSubject}.
testIterableFieldScopeMethodVariants_multimapWithProtoValuesSubject
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/FieldScopesTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/FieldScopesTest.java
Apache-2.0
@Parameters(name = "{0}") public static Collection<Object[]> parameters() { return ProtoSubjectTestBase.parameters(); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
parameters
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
@Test public void testPlain_isEmpty() { expectThat(ImmutableList.<Message>of()).isEmpty(); expectThat(listOf(message1)).isNotEmpty(); expectFailureWhenTesting().that(listOf(message1)).isEmpty(); expectThatFailure().isNotNull(); expectFailureWhenTesting().that(ImmutableList.<Message>of()).isNotEmpty(); expectThatFailure().isNotNull(); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_isEmpty
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
@Test public void testPlain_hasSize() { expectThat(listOf(message1, message2)).hasSize(2); expectFailureWhenTesting().that(listOf(message1)).hasSize(3); expectThatFailure().isNotNull(); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_hasSize
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
@Test public void testPlain_containsNoDuplicates() { expectThat(listOf(message1, message2)).containsNoDuplicates(); expectFailureWhenTesting().that(listOf(message1, eqMessage1)).containsNoDuplicates(); expectThatFailure().isNotNull(); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_containsNoDuplicates
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
@Test public void testPlain_contains() { expectThat(listOf(message1, message2)).contains(eqMessage2); expectThat(listOf(message1, message2)).doesNotContain(eqIgnoredMessage1); expectFailureWhenTesting().that(listOf(message1, message2)).contains(eqIgnoredMessage1); expectThatFailure().isNotNull(); expectFailureWhenTesting().that(listOf(message1, message2)).doesNotContain(eqMessage1); expectThatFailure().isNotNull(); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_contains
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
@Test public void testPlain_containsAny() { expectThat(listOf(message1, message2)).containsAnyOf(eqIgnoredMessage1, eqMessage2); expectThat(listOf(message1, message2)).containsAnyIn(listOf(eqIgnoredMessage1, eqMessage2)); expectThat(listOf(message1, message2)).containsAnyIn(arrayOf(eqIgnoredMessage1, eqMessage2)); expectFailureWhenTesting() .that(listOf(message1, message2)) .containsAnyOf(eqIgnoredMessage1, eqIgnoredMessage2); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(listOf(message1, message2)) .containsAnyIn(listOf(eqIgnoredMessage1, eqIgnoredMessage2)); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(listOf(message1, message2)) .containsAnyIn(arrayOf(eqIgnoredMessage1, eqIgnoredMessage2)); expectThatFailure().isNotNull(); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_containsAny
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
@Test public void testPlain_containsAtLeast() { expectThat(listOf(message1, message2, eqIgnoredMessage1)) .containsAtLeast(eqMessage1, eqMessage2); expectThat(listOf(message1, message2, eqIgnoredMessage1)) .containsAtLeastElementsIn(listOf(eqMessage1, eqMessage2)); expectThat(listOf(message1, message2, eqIgnoredMessage1)) .containsAtLeastElementsIn(arrayOf(eqMessage1, eqMessage2)); expectFailureWhenTesting().that(listOf(message1)).containsAtLeast(eqMessage1, eqMessage2); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(listOf(message1)) .containsAtLeastElementsIn(listOf(eqMessage1, eqMessage2)); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(listOf(message1)) .containsAtLeastElementsIn(arrayOf(eqMessage1, eqMessage2)); expectThatFailure().isNotNull(); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_containsAtLeast
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
@Test public void testPlain_containsExactly() { expectThat(listOf(message1, message2)).containsExactly(eqMessage2, eqMessage1); expectThat(listOf(message1, message2)).containsExactly(eqMessage1, eqMessage2).inOrder(); expectThat(listOf(message1, message2)) .containsExactlyElementsIn(listOf(eqMessage2, eqMessage1)); expectThat(listOf(message1, message2)) .containsExactlyElementsIn(listOf(eqMessage1, eqMessage2)) .inOrder(); expectThat(listOf(message1, message2)) .containsExactlyElementsIn(arrayOf(eqMessage2, eqMessage1)); expectThat(listOf(message1, message2)) .containsExactlyElementsIn(arrayOf(eqMessage1, eqMessage2)) .inOrder(); expectFailureWhenTesting().that(listOf(message1)).containsExactly(eqMessage1, eqMessage2); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(listOf(message1, message2)) .containsExactly(eqMessage2, eqMessage1) .inOrder(); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(listOf(message1)) .containsExactlyElementsIn(listOf(eqMessage1, eqMessage2)); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(listOf(message1, message2)) .containsExactlyElementsIn(listOf(eqMessage2, eqMessage1)) .inOrder(); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(listOf(message1)) .containsExactlyElementsIn(arrayOf(eqMessage1, eqMessage2)); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(listOf(message1, message2)) .containsExactlyElementsIn(arrayOf(eqMessage2, eqMessage1)) .inOrder(); expectThatFailure().isNotNull(); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_containsExactly
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
@Test public void testPlain_containsNone() { expectThat(listOf(message1)).containsNoneOf(eqMessage2, eqIgnoredMessage1); expectThat(listOf(message1)).containsNoneIn(listOf(eqMessage2, eqIgnoredMessage1)); expectThat(listOf(message1)).containsNoneIn(arrayOf(eqMessage2, eqIgnoredMessage1)); expectFailureWhenTesting() .that(listOf(message1, message2)) .containsNoneOf(eqMessage2, eqIgnoredMessage1); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(listOf(message1, message2)) .containsNoneIn(listOf(eqMessage2, eqIgnoredMessage1)); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(listOf(message1, message2)) .containsNoneIn(arrayOf(eqMessage2, eqIgnoredMessage1)); expectThatFailure().isNotNull(); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_containsNone
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
@Test public void testPlain_isInOrder() { expectThat(listOf(message1, eqMessage1, message2)).isInOrder(compareByOIntAscending()); expectThat(listOf(message1, message2)).isInStrictOrder(compareByOIntAscending()); expectFailureWhenTesting().that(listOf(message2, message1)).isInOrder(compareByOIntAscending()); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(listOf(message1, eqMessage1, message2)) .isInStrictOrder(compareByOIntAscending()); expectThatFailure().isNotNull(); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_isInOrder
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
@Test public void testFluent_contains() { expectThat(listOf(message1, message2)) .ignoringFields(ignoreFieldNumber) .contains(eqIgnoredMessage1); expectThat(listOf(message1, message2)) .ignoringRepeatedFieldOrder() .doesNotContain(eqIgnoredMessage1); expectFailureWhenTesting() .that(listOf(message1, message2)) .ignoringFields(ignoreFieldNumber) .contains(eqRepeatedMessage1); expectThatFailure() .factValue("testing whether") .contains( "is equivalent according to " + "assertThat(proto)" + ".ignoringFields(" + fullMessageName() + ".o_int)" + ".isEqualTo(target)"); expectFailureWhenTesting() .that(listOf(message1, message2)) .ignoringRepeatedFieldOrder() .doesNotContain(eqRepeatedMessage1); expectThatFailure() .factValue("testing whether") .contains( "is equivalent according to " + "assertThat(proto).ignoringRepeatedFieldOrder().isEqualTo(target)"); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testFluent_contains
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
@Test public void testFluent_containsAny() { expectThat(listOf(message1, message2)) .ignoringFields(ignoreFieldNumber) .containsAnyOf(eqIgnoredMessage1, eqRepeatedMessage2); expectThat(listOf(message1, message2)) .ignoringRepeatedFieldOrder() .containsAnyIn(listOf(eqIgnoredMessage1, eqRepeatedMessage2)); expectFailureWhenTesting() .that(listOf(message1, message2)) .ignoringFields(ignoreFieldNumber) .containsAnyOf(eqRepeatedMessage1, eqRepeatedMessage2); expectThatFailure() .factValue("testing whether") .contains( "is equivalent according to " + "assertThat(proto)" + ".ignoringFields(" + fullMessageName() + ".o_int)" + ".isEqualTo(target)"); expectFailureWhenTesting() .that(listOf(message1, message2)) .ignoringRepeatedFieldOrder() .containsAnyIn(listOf(eqIgnoredMessage1, eqIgnoredMessage2)); expectThatFailure() .factValue("testing whether") .contains( "is equivalent according to " + "assertThat(proto).ignoringRepeatedFieldOrder().isEqualTo(target)"); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testFluent_containsAny
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
@Test public void testFluent_containsAtLeast() { expectThat(listOf(message1, message2, eqRepeatedMessage2)) .ignoringFields(ignoreFieldNumber) .containsAtLeast(eqIgnoredMessage1, eqIgnoredMessage2); expectThat(listOf(message1, message2, eqIgnoredMessage1)) .ignoringRepeatedFieldOrder() .containsAtLeastElementsIn(listOf(eqRepeatedMessage1, eqRepeatedMessage2)); expectFailureWhenTesting() .that(listOf(message1)) .ignoringRepeatedFieldOrder() .containsAtLeast(eqMessage1, eqMessage2); expectThatFailure() .factValue("testing whether") .contains( "is equivalent according to " + "assertThat(proto).ignoringRepeatedFieldOrder().isEqualTo(target)"); expectFailureWhenTesting() .that(listOf(message1)) .ignoringRepeatedFieldOrder() .containsAtLeastElementsIn(listOf(eqMessage1, eqMessage2)); expectThatFailure() .factValue("testing whether") .contains( "is equivalent according to " + "assertThat(proto).ignoringRepeatedFieldOrder().isEqualTo(target)"); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testFluent_containsAtLeast
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
@Test public void testFluent_containsExactly() { expectThat(listOf(message1, message2)) .ignoringFields(ignoreFieldNumber) .containsExactly(eqIgnoredMessage2, eqIgnoredMessage1); expectThat(listOf(message1, message2)) .ignoringRepeatedFieldOrder() .containsExactly(eqRepeatedMessage1, eqRepeatedMessage2) .inOrder(); expectThat(listOf(message1, message2)) .ignoringFields(ignoreFieldNumber) .containsExactlyElementsIn(listOf(eqIgnoredMessage2, eqIgnoredMessage1)); expectThat(listOf(message1, message2)) .ignoringRepeatedFieldOrder() .containsExactlyElementsIn(listOf(eqRepeatedMessage1, eqRepeatedMessage2)) .inOrder(); expectFailureWhenTesting() .that(listOf(message1)) .ignoringRepeatedFieldOrder() .containsExactly(eqMessage1, eqMessage2); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(listOf(message1, message2)) .ignoringRepeatedFieldOrder() .containsExactly(eqMessage2, eqMessage1) .inOrder(); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(listOf(message1)) .ignoringRepeatedFieldOrder() .containsExactlyElementsIn(listOf(eqMessage1, eqMessage2)); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(listOf(message1, message2)) .ignoringRepeatedFieldOrder() .containsExactlyElementsIn(listOf(eqMessage2, eqMessage1)) .inOrder(); expectThatFailure().isNotNull(); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testFluent_containsExactly
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
@Test public void testFluent_containsNone() { expectThat(listOf(message1)) .ignoringFields(ignoreFieldNumber) .containsNoneOf(eqMessage2, eqRepeatedMessage1); expectThat(listOf(message1)) .ignoringRepeatedFieldOrder() .containsNoneIn(listOf(eqMessage2, eqIgnoredMessage1)); expectFailureWhenTesting() .that(listOf(message1, message2)) .ignoringFields(ignoreFieldNumber) .containsNoneOf(eqRepeatedMessage1, eqIgnoredMessage2); expectThatFailure() .factValue("testing whether") .contains( "is equivalent according to " + "assertThat(proto)" + ".ignoringFields(" + fullMessageName() + ".o_int)" + ".isEqualTo(target)"); expectFailureWhenTesting() .that(listOf(message1, message2)) .ignoringRepeatedFieldOrder() .containsNoneIn(listOf(eqIgnoredMessage1, eqRepeatedMessage2)); expectThatFailure() .factValue("testing whether") .contains( "is equivalent according to " + "assertThat(proto).ignoringRepeatedFieldOrder().isEqualTo(target)"); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testFluent_containsNone
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
@Test public void testFluent_correspondenceToString() { // Some arbitrary tests to ensure Correspondence.toString() is well-behaved. // Not intended to be comprehensive. // TODO(user): Consider actually adding newlines as the strings are formatted here to make the // error messages look prettier. Might require some thought to avoid eating too much vertical // space, also indentation adds complexity. expectFailureWhenTesting() .that(listOf(message1)) .withPartialScope(FieldScopes.fromSetFields(message2)) .ignoringRepeatedFieldOrder() .contains(message2); expectThatFailure() .factValue("testing whether") .contains( "assertThat(proto).withPartialScope(FieldScopes.fromSetFields({o_int: 3\n" + "r_string: \"baz\"\n" + "r_string: \"qux\"\n" + "})).ignoringRepeatedFieldOrder().isEqualTo(target)"); expectFailureWhenTesting() .that(listOf(message1)) .ignoringRepeatedFieldOrder() .ignoringFieldScope( FieldScopes.ignoringFields(getFieldNumber("o_int"), getFieldNumber("r_string"))) .ignoringFieldAbsence() .contains(message2); expectThatFailure() .factValue("testing whether") .contains( "assertThat(proto)" + ".ignoringRepeatedFieldOrder()" + ".ignoringFieldScope(" + "FieldScopes.ignoringFields(" + fullMessageName() + ".o_int, " + fullMessageName() + ".r_string))" + ".ignoringFieldAbsence()" + ".isEqualTo(target)"); expectFailureWhenTesting() .that(listOf(message1)) .ignoringFields(getFieldNumber("o_enum"), getFieldNumber("o_test_message")) .reportingMismatchesOnly() .contains(message2); expectThatFailure() .factValue("testing whether") .contains( "assertThat(proto)" + ".ignoringFields(" + fullMessageName() + ".o_enum, " + fullMessageName() + ".o_test_message)" + ".reportingMismatchesOnly()" + ".isEqualTo(target)"); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testFluent_correspondenceToString
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
@Test public void testFormatDiff() { expectFailureWhenTesting() .that(listOf(message1)) .ignoringRepeatedFieldOrder() .containsExactly(message2); expectThatFailure() .factValue("diff") .isEqualTo( "Differences were found:\n" + "modified: o_int: 3 -> 1\n" + "added: r_string[0]: \"foo\"\n" + "added: r_string[1]: \"bar\"\n" + "deleted: r_string[0]: \"baz\"\n" + "deleted: r_string[1]: \"qux\"\n"); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testFormatDiff
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
@Test public void testDisplayingDiffsPairedBy() { Message actualInt3 = parse("o_int: 3 r_string: 'foo'"); Message actualInt4 = parse("o_int: 4 r_string: 'bar'"); Message expectedInt3 = parse("o_int: 3 r_string: 'baz'"); Message expectedInt4 = parse("o_int: 4 r_string: 'qux'"); Function<Message, Integer> getInt = message -> (Integer) message.getField(getFieldDescriptor("o_int")); expectFailureWhenTesting() .that(listOf(actualInt3, actualInt4)) .displayingDiffsPairedBy(getInt) .containsExactly(expectedInt3, expectedInt4); expectThatFailure().factValue("diff", 0).contains("modified: r_string[0]: \"baz\" -> \"foo\""); expectThatFailure().factValue("diff", 1).contains("modified: r_string[0]: \"qux\" -> \"bar\""); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testDisplayingDiffsPairedBy
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
@Test public void testCompareMultipleMessageTypes() { // Don't run this test twice. if (!testIsRunOnce()) { return; } expectThat( listOf( TestMessage2.newBuilder().addRString("foo").addRString("bar").build(), TestMessage3.newBuilder().addRString("baz").addRString("qux").build())) .ignoringRepeatedFieldOrder() .containsExactly( TestMessage3.newBuilder().addRString("qux").addRString("baz").build(), TestMessage2.newBuilder().addRString("bar").addRString("foo").build()); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testCompareMultipleMessageTypes
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
private Comparator<Message> compareByOIntAscending() { return comparing(message -> (Integer) message.getField(getFieldDescriptor("o_int"))); }
Tests for {@link IterableOfProtosSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.IterableSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
compareByOIntAscending
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/IterableOfProtosSubjectTest.java
Apache-2.0
@Parameters(name = "{0}") public static Collection<Object[]> parameters() { return ProtoSubjectTestBase.parameters(); }
Tests for {@link MapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
parameters
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testPlain_isEqualTo() { expectThat(mapOf(1, message1, 2, message2)).isEqualTo(mapOf(2, eqMessage2, 1, eqMessage1)); expectThat(mapOf(1, message2)).isNotEqualTo(mapOf(1, message1)); expectFailureWhenTesting() .that(mapOf(1, message2, 2, message1)) .isEqualTo(mapOf(1, eqMessage1, 2, eqMessage2)); expectThatFailure().isNotNull(); expectFailureWhenTesting().that(mapOf(1, message1)).isNotEqualTo(mapOf(1, eqMessage1)); expectThatFailure().isNotNull(); }
Tests for {@link MapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_isEqualTo
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testPlain_isEmpty() { expectThat(ImmutableMap.<Object, Message>of()).isEmpty(); expectThat(mapOf(1, message1)).isNotEmpty(); expectFailureWhenTesting().that(mapOf(1, message1)).isEmpty(); expectThatFailure().isNotNull(); expectFailureWhenTesting().that(ImmutableMap.<Object, Message>of()).isNotEmpty(); expectThatFailure().isNotNull(); }
Tests for {@link MapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_isEmpty
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testPlain_hasSize() { expectThat(mapOf(1, message1, 2, message2)).hasSize(2); expectFailureWhenTesting().that(mapOf(1, message1)).hasSize(3); expectThatFailure().isNotNull(); }
Tests for {@link MapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_hasSize
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testPlain_containsKey() { expectThat(mapOf(1, message1, 2, message2)).containsKey(1); expectThat(mapOf(1, message1, 2, message2)).doesNotContainKey(3); expectFailureWhenTesting().that(mapOf(1, message1, 2, message2)).containsKey(3); expectThatFailure().isNotNull(); expectFailureWhenTesting().that(mapOf(1, message1, 2, message2)).doesNotContainKey(2); expectThatFailure().isNotNull(); }
Tests for {@link MapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_containsKey
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testPlain_containsEntry() { expectThat(mapOf(1, message1, 2, message2)).containsEntry(2, eqMessage2); expectThat(mapOf(1, message1, 2, message2)).doesNotContainEntry(1, eqMessage2); expectFailureWhenTesting().that(mapOf(1, message1, 2, message2)).containsEntry(2, eqMessage1); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(mapOf(1, message1, 2, message2)) .doesNotContainEntry(2, eqMessage2); expectThatFailure().isNotNull(); }
Tests for {@link MapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_containsEntry
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testPlain_containsExactly() { expectThat(mapOf(1, message1, 2, message2)).containsExactly(2, eqMessage2, 1, eqMessage1); expectThat(mapOf(1, message1, 2, message2)) .containsExactly(1, eqMessage1, 2, eqMessage2) .inOrder(); expectThat(mapOf(1, message1, 2, message2)) .containsExactlyEntriesIn(mapOf(2, eqMessage2, 1, eqMessage1)); expectThat(mapOf(1, message1, 2, message2)) .containsExactlyEntriesIn(mapOf(1, eqMessage1, 2, eqMessage2)) .inOrder(); expectFailureWhenTesting() .that(mapOf(1, message1)) .containsExactly(1, eqMessage1, 2, eqMessage2); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(mapOf(1, message1, 2, message2)) .containsExactly(2, eqMessage2, 1, eqMessage1) .inOrder(); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(mapOf(1, message1)) .containsExactlyEntriesIn(mapOf(2, eqMessage2, 1, eqMessage1)); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(mapOf(1, message1, 2, message2)) .containsExactlyEntriesIn(mapOf(2, eqMessage2, 1, eqMessage1)) .inOrder(); expectThatFailure().isNotNull(); }
Tests for {@link MapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_containsExactly
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testFluent_containsEntry() { expectThat(mapOf(1, message1, 2, message2)) .ignoringFieldsForValues(ignoreFieldNumber) .containsEntry(1, eqIgnoredMessage1); expectThat(mapOf(1, message1, 2, message2)) .ignoringRepeatedFieldOrderForValues() .doesNotContainEntry(1, eqIgnoredMessage1); expectFailureWhenTesting() .that(mapOf(1, message1, 2, message2)) .ignoringFieldsForValues(ignoreFieldNumber) .containsEntry(1, eqRepeatedMessage1); expectThatFailure() .hasMessageThat() .contains( "is equivalent according to " + "assertThat(proto)" + ".ignoringFields(" + fullMessageName() + ".o_int)" + ".isEqualTo(target)"); expectFailureWhenTesting() .that(mapOf(1, message1, 2, message2)) .ignoringRepeatedFieldOrderForValues() .doesNotContainEntry(1, eqRepeatedMessage1); expectThatFailure() .hasMessageThat() .contains( "is equivalent according to " + "assertThat(proto).ignoringRepeatedFieldOrder().isEqualTo(target)"); }
Tests for {@link MapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testFluent_containsEntry
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testFluent_containsExactly() { expectThat(mapOf(1, message1, 2, message2)) .ignoringFieldsForValues(ignoreFieldNumber) .containsExactly(2, eqIgnoredMessage2, 1, eqIgnoredMessage1); expectThat(mapOf(1, message1, 2, message2)) .ignoringRepeatedFieldOrderForValues() .containsExactly(1, eqRepeatedMessage1, 2, eqRepeatedMessage2) .inOrder(); expectThat(mapOf(1, message1, 2, message2)) .ignoringFieldsForValues(ignoreFieldNumber) .containsExactlyEntriesIn(mapOf(2, eqIgnoredMessage2, 1, eqIgnoredMessage1)); expectThat(mapOf(1, message1, 2, message2)) .ignoringRepeatedFieldOrderForValues() .containsExactlyEntriesIn(mapOf(1, eqRepeatedMessage1, 2, eqRepeatedMessage2)) .inOrder(); expectFailureWhenTesting() .that(mapOf(1, message1)) .ignoringRepeatedFieldOrderForValues() .containsExactly(1, eqRepeatedMessage1, 2, eqMessage2); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(mapOf(1, message1, 2, message2)) .ignoringFieldsForValues(ignoreFieldNumber) .containsExactly(2, eqIgnoredMessage2, 1, eqIgnoredMessage1) .inOrder(); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(mapOf(1, message1)) .ignoringRepeatedFieldOrderForValues() .containsExactlyEntriesIn(mapOf(2, eqRepeatedMessage2, 1, eqRepeatedMessage1)); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(mapOf(1, message1, 2, message2)) .ignoringFieldsForValues(ignoreFieldNumber) .containsExactlyEntriesIn(mapOf(2, eqIgnoredMessage2, 1, eqIgnoredMessage1)) .inOrder(); expectThatFailure().isNotNull(); }
Tests for {@link MapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testFluent_containsExactly
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testCompareMultipleMessageTypes() { // Don't run this test twice. if (!testIsRunOnce()) { return; } expectThat( ImmutableMap.of( 2, TestMessage2.newBuilder().addRString("foo").addRString("bar").build(), 3, TestMessage3.newBuilder().addRString("baz").addRString("qux").build())) .ignoringRepeatedFieldOrderForValues() .containsExactly( 3, TestMessage3.newBuilder().addRString("qux").addRString("baz").build(), 2, TestMessage2.newBuilder().addRString("bar").addRString("foo").build()); }
Tests for {@link MapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testCompareMultipleMessageTypes
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testMethodNamesEndWithForValues() { checkMethodNamesEndWithForValues(MapWithProtoValuesSubject.class, MapSubject.class); checkMethodNamesEndWithForValues(MapWithProtoValuesFluentAssertion.class, MapSubject.class); }
Tests for {@link MapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testMethodNamesEndWithForValues
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubjectTest.java
Apache-2.0
StandardSubjectBuilder whenTesting() { Preconditions.checkState( currentIndex < expectFailures.size() - 1, "Not enough ExpectFailures (%s)", expectFailures.size()); return expectFailures.get(++currentIndex).whenTesting(); }
A collection of {@link ExpectFailure} rules, for use in a single test case. <p>Users should instantiate {@code MultiExpectFailure} as a {@code @Rule}, then use {@link #whenTesting()} and {@link #getFailure()} just like you would with an ordinary {@link ExpectFailure} rule. Each call to {@link #whenTesting()} will clobber the previous {@link #getFailure()} results.
whenTesting
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultiExpectFailure.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultiExpectFailure.java
Apache-2.0
AssertionError getFailure() { Preconditions.checkState(currentIndex >= 0, "Must call 'whenTesting()' first."); return expectFailures.get(currentIndex).getFailure(); }
A collection of {@link ExpectFailure} rules, for use in a single test case. <p>Users should instantiate {@code MultiExpectFailure} as a {@code @Rule}, then use {@link #whenTesting()} and {@link #getFailure()} just like you would with an ordinary {@link ExpectFailure} rule. Each call to {@link #whenTesting()} will clobber the previous {@link #getFailure()} results.
getFailure
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultiExpectFailure.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultiExpectFailure.java
Apache-2.0
@Override public Statement apply(Statement base, Description description) { Statement statement = base; for (ExpectFailure expectFailure : expectFailures) { statement = expectFailure.apply(statement, description); } return statement; }
A collection of {@link ExpectFailure} rules, for use in a single test case. <p>Users should instantiate {@code MultiExpectFailure} as a {@code @Rule}, then use {@link #whenTesting()} and {@link #getFailure()} just like you would with an ordinary {@link ExpectFailure} rule. Each call to {@link #whenTesting()} will clobber the previous {@link #getFailure()} results.
apply
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultiExpectFailure.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultiExpectFailure.java
Apache-2.0
@Parameters(name = "{0}") public static Collection<Object[]> parameters() { return ProtoSubjectTestBase.parameters(); }
Tests for {@link MultimapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MultimapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
parameters
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testPlain_isEmpty() { expectThat(ImmutableMultimap.<Object, Message>of()).isEmpty(); expectThat(multimapOf(1, message1)).isNotEmpty(); expectFailureWhenTesting().that(multimapOf(1, message1)).isEmpty(); expectThatFailure().isNotNull(); expectFailureWhenTesting().that(ImmutableMap.<Object, Message>of()).isNotEmpty(); expectThatFailure().isNotNull(); }
Tests for {@link MultimapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MultimapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_isEmpty
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testPlain_hasSize() { expectThat(multimapOf(1, message1, 1, message2, 2, message1)).hasSize(3); expectFailureWhenTesting().that(multimapOf(1, message1)).hasSize(3); expectThatFailure().isNotNull(); }
Tests for {@link MultimapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MultimapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_hasSize
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testPlain_containsKey() { expectThat(multimapOf(1, message1, 1, message2, 2, message1)).containsKey(1); expectThat(multimapOf(1, message1, 1, message2, 2, message1)).doesNotContainKey(3); expectFailureWhenTesting() .that(multimapOf(1, message1, 1, message2, 2, message1)) .containsKey(3); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(multimapOf(1, message1, 1, message2, 2, message1)) .doesNotContainKey(2); expectThatFailure().isNotNull(); }
Tests for {@link MultimapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MultimapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_containsKey
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testPlain_containsEntry() { expectThat(multimapOf(1, message1, 1, message2, 2, message1)).containsEntry(1, eqMessage2); expectThat(multimapOf(1, message1, 1, message2, 2, message1)) .doesNotContainEntry(2, eqMessage2); expectFailureWhenTesting() .that(multimapOf(1, message1, 1, message2, 2, message1)) .containsEntry(2, eqMessage2); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(multimapOf(1, message1, 1, message2, 2, message1)) .doesNotContainEntry(1, eqMessage2); expectThatFailure().isNotNull(); }
Tests for {@link MultimapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MultimapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_containsEntry
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testPlain_containsExactlyEntriesIn() { expectThat(multimapOf(1, message1, 1, message2, 2, message1)) .containsExactlyEntriesIn(multimapOf(1, eqMessage2, 2, eqMessage1, 1, eqMessage1)); expectThat(multimapOf(1, message1, 1, message2, 2, message1)) .containsExactlyEntriesIn(multimapOf(1, eqMessage1, 1, eqMessage2, 2, eqMessage1)) .inOrder(); expectFailureWhenTesting() .that(multimapOf(1, message1)) .containsExactlyEntriesIn(multimapOf(1, eqMessage1, 2, eqMessage2)); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(multimapOf(1, message1, 2, message2)) .containsExactlyEntriesIn(multimapOf(2, eqMessage2, 1, eqMessage1)) .inOrder(); expectThatFailure().isNotNull(); }
Tests for {@link MultimapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MultimapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_containsExactlyEntriesIn
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testPlain_containsExactlyNoArgs() { expectThat(ImmutableMultimap.<Object, Message>of()).containsExactly(); expectThat(ImmutableMultimap.<Object, Message>of()).containsExactly().inOrder(); expectFailureWhenTesting().that(multimapOf(1, message1)).containsExactly(); expectThatFailure().isNotNull(); }
Tests for {@link MultimapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MultimapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_containsExactlyNoArgs
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testPlain_containsExactly() { expectThat(multimapOf(1, message1, 1, message2, 2, message1)) .containsExactly(1, eqMessage2, 2, eqMessage1, 1, eqMessage1); expectThat(multimapOf(1, message1, 1, message2, 2, message1)) .containsExactly(1, eqMessage1, 1, eqMessage2, 2, eqMessage1) .inOrder(); expectFailureWhenTesting() .that(multimapOf(1, message1)) .containsExactly(1, eqMessage1, 2, eqMessage2); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(multimapOf(1, message1, 2, message2)) .containsExactly(2, eqMessage2, 1, eqMessage1) .inOrder(); expectThatFailure().isNotNull(); }
Tests for {@link MultimapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MultimapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_containsExactly
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testPlain_valuesForKey() { expectThat(multimapOf(1, message1, 1, message2, 2, message1)) .valuesForKey(1) .containsExactly(eqMessage2, eqMessage1); expectThat(multimapOf(1, message1, 1, message2, 2, message1)).valuesForKey(2).hasSize(1); expectFailureWhenTesting() .that(multimapOf(1, message1, 1, message2, 2, message1)) .valuesForKey(1) .containsExactly(eqMessage2, eqMessage1) .inOrder(); expectThatFailure().isNotNull(); }
Tests for {@link MultimapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MultimapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testPlain_valuesForKey
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testFluent_containsEntry() { expectThat(multimapOf(1, message1, 1, message2, 2, message1)) .ignoringFieldsForValues(ignoreFieldNumber) .containsEntry(1, eqIgnoredMessage2); expectThat(multimapOf(1, message1, 1, message2, 2, message1)) .ignoringRepeatedFieldOrderForValues() .doesNotContainEntry(1, eqIgnoredMessage2); expectFailureWhenTesting() .that(multimapOf(1, message1, 1, message2, 2, message1)) .ignoringFieldsForValues(ignoreFieldNumber) .containsEntry(1, eqRepeatedMessage2); expectThatFailure() .hasMessageThat() .contains( "is equivalent according to " + "assertThat(proto)" + ".ignoringFields(" + fullMessageName() + ".o_int)" + ".isEqualTo(target)"); expectFailureWhenTesting() .that(multimapOf(1, message1, 1, message2, 2, message1)) .ignoringRepeatedFieldOrderForValues() .doesNotContainEntry(1, eqRepeatedMessage2); expectThatFailure() .hasMessageThat() .contains( "is equivalent according to " + "assertThat(proto).ignoringRepeatedFieldOrder().isEqualTo(target)"); }
Tests for {@link MultimapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MultimapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testFluent_containsEntry
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testFluent_containsExactlyEntriesIn() { expectThat(multimapOf(1, message1, 1, message2, 2, message1)) .ignoringFieldsForValues(ignoreFieldNumber) .containsExactlyEntriesIn( multimapOf(1, eqIgnoredMessage2, 2, eqIgnoredMessage1, 1, eqIgnoredMessage1)); expectThat(multimapOf(1, message1, 1, message2, 2, message1)) .ignoringRepeatedFieldOrderForValues() .containsExactlyEntriesIn( multimapOf(1, eqRepeatedMessage1, 1, eqRepeatedMessage2, 2, eqRepeatedMessage1)) .inOrder(); expectFailureWhenTesting() .that(multimapOf(1, message1)) .ignoringRepeatedFieldOrderForValues() .containsExactlyEntriesIn(multimapOf(2, eqRepeatedMessage2, 1, eqRepeatedMessage1)); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(multimapOf(1, message1, 2, message2)) .ignoringFieldsForValues(ignoreFieldNumber) .containsExactlyEntriesIn(multimapOf(2, eqIgnoredMessage2, 1, eqIgnoredMessage1)) .inOrder(); expectThatFailure().isNotNull(); }
Tests for {@link MultimapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MultimapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testFluent_containsExactlyEntriesIn
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testFluent_containsExactly_noArgs() { expectThat(ImmutableMultimap.<Object, Message>of()) .ignoringRepeatedFieldOrderForValues() .containsExactly(); expectThat(ImmutableMultimap.<Object, Message>of()) .ignoringRepeatedFieldOrderForValues() .containsExactly() .inOrder(); expectFailureWhenTesting() .that(multimapOf(1, message1)) .ignoringRepeatedFieldOrderForValues() .containsExactly(); expectThatFailure().isNotNull(); }
Tests for {@link MultimapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MultimapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testFluent_containsExactly_noArgs
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testFluent_containsExactly() { expectThat(multimapOf(1, message1, 1, message2, 2, message1)) .ignoringFieldsForValues(ignoreFieldNumber) .containsExactly(1, eqIgnoredMessage2, 2, eqIgnoredMessage1, 1, eqIgnoredMessage1); expectThat(multimapOf(1, message1, 1, message2, 2, message1)) .ignoringRepeatedFieldOrderForValues() .containsExactly(1, eqRepeatedMessage1, 1, eqRepeatedMessage2, 2, eqRepeatedMessage1) .inOrder(); expectFailureWhenTesting() .that(multimapOf(1, message1)) .ignoringRepeatedFieldOrderForValues() .containsExactly(2, eqRepeatedMessage2, 1, eqRepeatedMessage1); expectThatFailure().isNotNull(); expectFailureWhenTesting() .that(multimapOf(1, message1, 2, message2)) .ignoringFieldsForValues(ignoreFieldNumber) .containsExactly(2, eqIgnoredMessage2, 1, eqIgnoredMessage1) .inOrder(); expectThatFailure().isNotNull(); }
Tests for {@link MultimapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MultimapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testFluent_containsExactly
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testFluent_valuesForKey() { expectThat(multimapOf(1, message1, 1, message2, 2, message1)) .valuesForKey(1) .ignoringFields(ignoreFieldNumber) .containsExactly(eqIgnoredMessage2, eqIgnoredMessage1); expectThat(multimapOf(1, message1, 1, message2, 2, message1)) .valuesForKey(2) .ignoringRepeatedFieldOrder() .containsExactly(eqRepeatedMessage1); expectFailureWhenTesting() .that(multimapOf(1, message1, 1, message2, 2, message1)) .valuesForKey(1) .ignoringFields(ignoreFieldNumber) .containsExactly(eqRepeatedMessage1, eqRepeatedMessage2); expectThatFailure().isNotNull(); }
Tests for {@link MultimapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MultimapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testFluent_valuesForKey
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testCompareMultipleMessageTypes() { // Don't run this test twice. if (!testIsRunOnce()) { return; } expectThat( ImmutableMultimap.of( 2, TestMessage2.newBuilder().addRString("foo").addRString("bar").build(), 2, TestMessage2.newBuilder().addRString("quibble").addRString("frozzit").build(), 3, TestMessage3.newBuilder().addRString("baz").addRString("qux").build())) .ignoringRepeatedFieldOrderForValues() .containsExactlyEntriesIn( ImmutableMultimap.of( 2, TestMessage2.newBuilder().addRString("frozzit").addRString("quibble").build(), 3, TestMessage3.newBuilder().addRString("qux").addRString("baz").build(), 2, TestMessage2.newBuilder().addRString("bar").addRString("foo").build())); }
Tests for {@link MultimapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MultimapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testCompareMultipleMessageTypes
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
Apache-2.0
@Test public void testMethodNamesEndWithForValues() { checkMethodNamesEndWithForValues(MultimapWithProtoValuesSubject.class, MultimapSubject.class); checkMethodNamesEndWithForValues( MultimapWithProtoValuesFluentAssertion.class, MultimapSubject.class); }
Tests for {@link MultimapWithProtoValuesSubject}. <p>Individual equality fuzzing is thoroughly tested by {@link ProtoSubjectTest}, while fuzzy equality testing is thoroughly tested by {@link com.google.common.truth.MultimapSubjectTest}. Thus, we simply check that all of the exposed methods work in basic cases, and trust that the implementation ensures correctness in the cross-product of the many ways one can do things.
testMethodNamesEndWithForValues
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubjectTest.java
Apache-2.0
@Override protected TestMessage2 parse(String string) { return (TestMessage2) super.parse(string); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
parse
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testObjectOverloads_testMessages_normalMethods() { TestMessage2 message = parse("r_string: \"foo\" r_string: \"bar\""); TestMessage2 eqMessage = parse("r_string: \"foo\" r_string: \"bar\""); TestMessage2 diffMessage = parse("r_string: \"bar\" r_string: \"foo\""); Object anObject = message; Object eqObject = eqMessage; Object diffObject = diffMessage; assertThat(message).isSameInstanceAs(anObject); assertThat(message).isNotSameInstanceAs(eqMessage); assertThat(message).isEqualTo(eqMessage); assertThat(message).isNotEqualTo(diffMessage); assertThat(message).isEqualTo(eqObject); assertThat(message).isNotEqualTo(diffObject); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testObjectOverloads_testMessages_normalMethods
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testObjectOverloads_testMessages_specializedMethods() { TestMessage2 message = parse("r_string: \"foo\" r_string: \"bar\""); TestMessage2 diffMessage = parse("r_string: \"bar\" r_string: \"foo\""); assertThat(message).ignoringRepeatedFieldOrder().isEqualTo(diffMessage); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testObjectOverloads_testMessages_specializedMethods
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testObjectOverloads_objects_actuallyMessages() { TestMessage2 message = parse("r_string: \"foo\" r_string: \"bar\""); TestMessage2 eqMessage = parse("r_string: \"foo\" r_string: \"bar\""); TestMessage2 diffMessage = parse("r_string: \"bar\" r_string: \"foo\""); Object anObject = message; Object eqObject = eqMessage; Object diffObject = diffMessage; assertThat(anObject).isSameInstanceAs(message); assertThat(anObject).isNotSameInstanceAs(eqObject); assertThat(anObject).isEqualTo(eqObject); assertThat(anObject).isNotEqualTo(diffObject); assertThat(anObject).isEqualTo(eqMessage); assertThat(anObject).isNotEqualTo(diffMessage); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testObjectOverloads_objects_actuallyMessages
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testObjectOverloads_objects_actuallyNotMessages() { TestMessage2 message = parse("r_string: \"foo\" r_string: \"bar\""); Object altObject = 1111; Object eqAltObject = (1 + 10 + 100 + 1000); assertThat(altObject).isEqualTo(eqAltObject); assertThat(altObject).isNotEqualTo(message); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testObjectOverloads_objects_actuallyNotMessages
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testIterableOverloads_assertAbout() { TestMessage2 message1 = parse("o_int: 1 r_string: \"foo\""); TestMessage2 message2 = parse("o_int: 2 r_string: \"bar\""); TestMessage2 eqMessage2 = parse("o_int: 2 r_string: \"bar\""); assertAbout(protos()).that(listOf(message1, message2)).contains(eqMessage2); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testIterableOverloads_assertAbout
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testIterableOverloads_testMessages_normalMethods() { TestMessage2 message1 = parse("o_int: 1 r_string: \"foo\""); TestMessage2 message2 = parse("o_int: 2 r_string: \"bar\""); TestMessage2 eqMessage2 = parse("o_int: 2 r_string: \"bar\""); TestMessage2 message3 = parse("o_int: 3 r_string: \"baz\""); TestMessage2 message4 = parse("o_int: 4 r_string: \"qux\""); Object object1 = message1; Object object2 = message2; ImmutableSet<TestMessage2> actualMessages = ImmutableSet.of(message1, message2); assertThat(actualMessages).containsExactly(message1, message2).inOrder(); assertThat(actualMessages).containsExactly(object1, object2).inOrder(); assertThat(actualMessages).hasSize(2); assertThat(actualMessages).containsAnyOf(message3, eqMessage2, message4); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testIterableOverloads_testMessages_normalMethods
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testIterableOverloads_testMessages_specializedMethods() { TestMessage2 message1 = parse("o_int: 1 r_string: \"foo\""); TestMessage2 message2 = parse("o_int: 2 r_string: \"bar\""); TestMessage2 message3 = parse("o_int: 3 r_string: \"baz\""); TestMessage2 message4 = parse("o_int: 4 r_string: \"qux\""); ImmutableSet<TestMessage2> actualMessages = ImmutableSet.of(message1, message2); assertThat(actualMessages) .ignoringFields(getFieldNumber("o_int"), getFieldNumber("r_string")) .containsExactly(message3, message4) .inOrder(); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testIterableOverloads_testMessages_specializedMethods
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testIterableOverloads_objects_actuallyMessages() { TestMessage2 message1 = parse("o_int: 1 r_string: \"foo\""); TestMessage2 message2 = parse("o_int: 2 r_string: \"bar\""); TestMessage2 eqMessage2 = parse("o_int: 2 r_string: \"bar\""); TestMessage2 message3 = parse("o_int: 3 r_string: \"baz\""); TestMessage2 message4 = parse("o_int: 4 r_string: \"qux\""); Object object1 = message1; Object object2 = message2; ImmutableList<Object> actualObjects = ImmutableList.of(object1, object2); assertThat(actualObjects).containsExactly(message1, message2).inOrder(); assertThat(actualObjects).hasSize(2); assertThat(actualObjects).containsAnyOf(message3, eqMessage2, message4); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testIterableOverloads_objects_actuallyMessages
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testIterableOverloads_objects_actuallyNotMessages() { TestMessage2 message1 = TestMessage2.newBuilder().setOInt(1).addRString("foo").build(); TestMessage2 message2 = TestMessage2.newBuilder().setOInt(2).addRString("bar").build(); ImmutableList<Object> altActualObjects = ImmutableList.<Object>of("Foo!", 42); assertThat(altActualObjects).containsExactly(21 * 2, "Foo! Bar!".substring(0, 4)); assertThat(altActualObjects).containsNoneOf(message1, message2); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testIterableOverloads_objects_actuallyNotMessages
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testMapOverloads_assertAbout() { TestMessage2 message1 = parse("o_int: 1 r_string: \"foo\""); TestMessage2 message2 = parse("o_int: 2 r_string: \"bar\""); TestMessage2 eqMessage2 = parse("o_int: 2 r_string: \"bar\""); assertAbout(protos()).that(mapOf(1, message1, 2, message2)).containsEntry(2, eqMessage2); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testMapOverloads_assertAbout
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testMapOverloads_testMessages_normalMethods() { TestMessage2 message1 = parse("o_int: 1 r_string: \"foo\""); TestMessage2 message2 = parse("o_int: 2 r_string: \"bar\""); TestMessage2 eqMessage2 = parse("o_int: 2 r_string: \"bar\""); Object object1 = message1; Object object2 = message2; ImmutableMap<Integer, TestMessage2> actualMessages = mapOf(1, message1, 2, message2); assertThat(actualMessages).containsExactly(1, message1, 2, message2).inOrder(); assertThat(actualMessages).containsExactly(1, object1, 2, object2).inOrder(); assertThat(actualMessages).hasSize(2); assertThat(actualMessages).isEqualTo(mapOf(2, eqMessage2, 1, object1)); assertThat(actualMessages).isNotEqualTo(mapOf(1, object2, 2, object1)); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testMapOverloads_testMessages_normalMethods
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testMapOverloads_testMessages_specializedMethods() { TestMessage2 message1 = parse("o_int: 1 r_string: \"foo\""); TestMessage2 message2 = parse("o_int: 2 r_string: \"bar\""); TestMessage2 message3 = parse("o_int: 3 r_string: \"baz\""); TestMessage2 message4 = parse("o_int: 4 r_string: \"qux\""); ImmutableMap<Integer, TestMessage2> actualMessages = mapOf(1, message1, 2, message2); assertThat(actualMessages) .ignoringFieldsForValues(getFieldNumber("o_int"), getFieldNumber("r_string")) .containsExactly(1, message3, 2, message4) .inOrder(); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testMapOverloads_testMessages_specializedMethods
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testMapOverloads_objects_actuallyMessages() { TestMessage2 message1 = parse("o_int: 1 r_string: \"foo\""); TestMessage2 message2 = parse("o_int: 2 r_string: \"bar\""); TestMessage2 eqMessage2 = parse("o_int: 2 r_string: \"bar\""); Object object1 = message1; Object object2 = message2; ImmutableMap<String, Object> actualObjects = mapOf("a", object1, "b", object2); assertThat(actualObjects).containsExactly("a", message1, "b", message2).inOrder(); assertThat(actualObjects).hasSize(2); assertThat(actualObjects).containsEntry("b", eqMessage2); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testMapOverloads_objects_actuallyMessages
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testMapOverloads_objects_actuallyNotMessages() { TestMessage2 message1 = TestMessage2.newBuilder().setOInt(1).addRString("foo").build(); TestMessage2 message2 = TestMessage2.newBuilder().setOInt(2).addRString("bar").build(); ImmutableMap<String, Object> altActualObjects = mapOf("a", (Object) "Foo!", "b", 42); assertThat(altActualObjects).containsExactly("a", "Foo! Bar!".substring(0, 4), "b", 21 * 2); assertThat(altActualObjects).doesNotContainEntry("a", message1); assertThat(altActualObjects).doesNotContainEntry("b", message2); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testMapOverloads_objects_actuallyNotMessages
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testMultimapOverloads_assertAbout() { TestMessage2 message1 = parse("o_int: 1 r_string: \"foo\""); TestMessage2 message2 = parse("o_int: 2 r_string: \"bar\""); TestMessage2 eqMessage2 = parse("o_int: 2 r_string: \"bar\""); assertAbout(protos()) .that(multimapOf(1, message1, 1, message2, 2, message1)) .containsEntry(1, eqMessage2); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testMultimapOverloads_assertAbout
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testMultimapOverloads_assertAbout_listAndSet() { TestMessage2 message1 = parse("o_int: 1 r_string: \"foo\""); TestMessage2 message2 = parse("o_int: 2 r_string: \"bar\""); ImmutableMultimap<Integer, TestMessage2> multimap = multimapOf(1, message1, 1, message2, 2, message1); ImmutableListMultimap<Integer, TestMessage2> listMultimap = ImmutableListMultimap.copyOf(multimap); ImmutableSetMultimap<Integer, TestMessage2> setMultimap = ImmutableSetMultimap.copyOf(multimap); assertAbout(protos()) .that(multimap) .ignoringRepeatedFieldOrderForValues() .containsExactlyEntriesIn(listMultimap); assertAbout(protos()) .that(listMultimap) .ignoringRepeatedFieldOrderForValues() .containsExactlyEntriesIn(setMultimap); assertAbout(protos()) .that(setMultimap) .ignoringRepeatedFieldOrderForValues() .containsExactlyEntriesIn(multimap); assertAbout(protos()).that(listMultimap).isNotEqualTo(setMultimap); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testMultimapOverloads_assertAbout_listAndSet
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testMultimapOverloads_testMessages_normalMethods() { TestMessage2 message1 = parse("o_int: 1 r_string: \"foo\""); TestMessage2 message2 = parse("o_int: 2 r_string: \"bar\""); TestMessage2 eqMessage2 = parse("o_int: 2 r_string: \"bar\""); Object object1 = message1; Object object2 = message2; ImmutableMultimap<Integer, TestMessage2> actualMessages = multimapOf(1, message1, 1, message2, 2, message1); assertThat(actualMessages) .containsExactlyEntriesIn(multimapOf(1, message1, 1, eqMessage2, 2, message1)) .inOrder(); assertThat(actualMessages).hasSize(3); assertThat(actualMessages).isEqualTo(multimapOf(2, message1, 1, message1, 1, eqMessage2)); assertThat(actualMessages).isNotEqualTo(multimapOf(2, object1, 1, object2, 1, object1)); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testMultimapOverloads_testMessages_normalMethods
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testMultimapOverloads_testMessages_normalMethods_listAndSet() { TestMessage2 message1 = parse("o_int: 1 r_string: \"foo\""); TestMessage2 message2 = parse("o_int: 2 r_string: \"bar\""); TestMessage2 eqMessage2 = parse("o_int: 2 r_string: \"bar\""); ImmutableMultimap<Integer, TestMessage2> multimap = multimapOf(1, message1, 1, message2, 2, message1); ImmutableListMultimap<Integer, TestMessage2> listMultimap = ImmutableListMultimap.copyOf(multimap); ImmutableSetMultimap<Integer, TestMessage2> setMultimap = ImmutableSetMultimap.copyOf(multimap); assertThat(multimap) .containsExactlyEntriesIn(multimapOf(1, message1, 1, eqMessage2, 2, message1)) .inOrder(); assertThat(listMultimap) .containsExactlyEntriesIn(multimapOf(1, message1, 1, eqMessage2, 2, message1)) .inOrder(); assertThat(setMultimap) .containsExactlyEntriesIn(multimapOf(1, message1, 1, eqMessage2, 2, message1)) .inOrder(); assertThat(multimap).hasSize(3); assertThat(listMultimap).hasSize(3); assertThat(setMultimap).hasSize(3); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testMultimapOverloads_testMessages_normalMethods_listAndSet
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testMultimapOverloads_testMessages_specializedMethods() { TestMessage2 message1 = parse("o_int: 1 r_string: \"foo\""); TestMessage2 message2 = parse("o_int: 2 r_string: \"bar\""); TestMessage2 message3 = parse("o_int: 3 r_string: \"baz\""); TestMessage2 message4 = parse("o_int: 4 r_string: \"qux\""); ImmutableMultimap<Integer, TestMessage2> actualMessages = multimapOf(1, message1, 1, message2, 2, message1); assertThat(actualMessages) .ignoringFieldsForValues(getFieldNumber("o_int"), getFieldNumber("r_string")) .containsExactlyEntriesIn(multimapOf(1, message3, 1, message4, 2, message3)) .inOrder(); assertThat(actualMessages) .valuesForKey(1) .ignoringFields(getFieldNumber("o_int"), getFieldNumber("r_string")) .containsExactly(message3, message4) .inOrder(); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testMultimapOverloads_testMessages_specializedMethods
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testMultimapOverloads_objects_actuallyMessages() { TestMessage2 message1 = parse("o_int: 1 r_string: \"foo\""); TestMessage2 message2 = parse("o_int: 2 r_string: \"bar\""); TestMessage2 eqMessage2 = parse("o_int: 2 r_string: \"bar\""); Object object1 = message1; Object object2 = message2; ImmutableMultimap<String, Object> actualObjects = multimapOf("a", object1, "a", object2, "b", object1); assertThat(actualObjects) .containsExactlyEntriesIn(multimapOf("a", message1, "a", message2, "b", message1)) .inOrder(); assertThat(actualObjects).hasSize(3); assertThat(actualObjects).containsEntry("a", eqMessage2); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testMultimapOverloads_objects_actuallyMessages
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
@Test public void testMultimapOverloads_objects_actuallyNotMessages() { TestMessage2 message1 = TestMessage2.newBuilder().setOInt(1).addRString("foo").build(); TestMessage2 message2 = TestMessage2.newBuilder().setOInt(2).addRString("bar").build(); ImmutableMultimap<String, Object> altActualObjects = multimapOf("a", (Object) "Foo!", "a", "Baz!", "b", 42); assertThat(altActualObjects) .containsExactlyEntriesIn( multimapOf("b", 21 * 2, "a", "Ba" + "z!", "a", "Foo! Bar!".substring(0, 4))); assertThat(altActualObjects).doesNotContainEntry("a", message1); assertThat(altActualObjects).doesNotContainEntry("b", message2); }
Test to ensure that Truth.assertThat and ProtoTruth.assertThat can coexist while statically imported. The tests themselves are simple and dumb, as what's really being tested here is whether or not this file compiles.
testMultimapOverloads_objects_actuallyNotMessages
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/OverloadResolutionTest.java
Apache-2.0
public Message defaultInstance() { return defaultInstance; }
Base class for testing {@link ProtoSubject} methods.
defaultInstance
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
public boolean isProto3() { return this == PROTO3; }
Base class for testing {@link ProtoSubject} methods.
isProto3
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected static Collection<Object[]> parameters() { ImmutableList.Builder<Object[]> builder = ImmutableList.builder(); for (TestType testType : TestType.values()) { builder.add(new Object[] {testType}); } return builder.build(); }
Base class for testing {@link ProtoSubject} methods.
parameters
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final Message fromUnknownFields(UnknownFieldSet unknownFieldSet) throws InvalidProtocolBufferException { return defaultInstance.getParserForType().parseFrom(unknownFieldSet.toByteArray()); }
Base class for testing {@link ProtoSubject} methods.
fromUnknownFields
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final String fullMessageName() { return defaultInstance.getDescriptorForType().getFullName(); }
Base class for testing {@link ProtoSubject} methods.
fullMessageName
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final FieldDescriptor getFieldDescriptor(String fieldName) { FieldDescriptor fieldDescriptor = defaultInstance.getDescriptorForType().findFieldByName(fieldName); checkArgument(fieldDescriptor != null, "No field named %s.", fieldName); return fieldDescriptor; }
Base class for testing {@link ProtoSubject} methods.
getFieldDescriptor
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final int getFieldNumber(String fieldName) { return getFieldDescriptor(fieldName).getNumber(); }
Base class for testing {@link ProtoSubject} methods.
getFieldNumber
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final TypeRegistry getTypeRegistry() { return typeRegistry; }
Base class for testing {@link ProtoSubject} methods.
getTypeRegistry
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final ExtensionRegistry getExtensionRegistry() { return extensionRegistry; }
Base class for testing {@link ProtoSubject} methods.
getExtensionRegistry
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final Message clone(Message in) { return in.toBuilder().build(); }
Base class for testing {@link ProtoSubject} methods.
clone
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected Message parse(String textProto) { try { Message.Builder builder = defaultInstance.toBuilder(); PARSER.merge(textProto, builder); return builder.build(); } catch (ParseException e) { throw new RuntimeException(e); } }
Base class for testing {@link ProtoSubject} methods.
parse
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final Message parsePartial(String textProto) { try { Message.Builder builder = defaultInstance.toBuilder(); PARSER.merge(textProto, builder); return builder.buildPartial(); } catch (ParseException e) { throw new RuntimeException(e); } }
Base class for testing {@link ProtoSubject} methods.
parsePartial
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final boolean isProto3() { return isProto3; }
Base class for testing {@link ProtoSubject} methods.
isProto3
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final boolean testIsRunOnce() { return isProto3; }
Some tests don't vary across the different proto types, and should only be run once. <p>This method returns true for exactly one {@link TestType}, and false for all the others, and so can be used to ensure tests are only run once.
testIsRunOnce
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final ProtoSubjectBuilder expectFailureWhenTesting() { return multiExpectFailure.whenTesting().about(ProtoTruth.protos()); }
Some tests don't vary across the different proto types, and should only be run once. <p>This method returns true for exactly one {@link TestType}, and false for all the others, and so can be used to ensure tests are only run once.
expectFailureWhenTesting
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final TruthFailureSubject expectThatFailure() { return expect.about(truthFailures()).that(multiExpectFailure.getFailure()); }
Some tests don't vary across the different proto types, and should only be run once. <p>This method returns true for exactly one {@link TestType}, and false for all the others, and so can be used to ensure tests are only run once.
expectThatFailure
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final ProtoSubject expectThat(@Nullable Message message) { return expect.about(ProtoTruth.protos()).that(message); }
Some tests don't vary across the different proto types, and should only be run once. <p>This method returns true for exactly one {@link TestType}, and false for all the others, and so can be used to ensure tests are only run once.
expectThat
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final <M extends Message> IterableOfProtosSubject<M> expectThat(Iterable<M> messages) { return expect.about(ProtoTruth.protos()).that(messages); }
Some tests don't vary across the different proto types, and should only be run once. <p>This method returns true for exactly one {@link TestType}, and false for all the others, and so can be used to ensure tests are only run once.
expectThat
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final <M extends Message> MapWithProtoValuesSubject<M> expectThat(Map<?, M> map) { return expect.about(ProtoTruth.protos()).that(map); }
Some tests don't vary across the different proto types, and should only be run once. <p>This method returns true for exactly one {@link TestType}, and false for all the others, and so can be used to ensure tests are only run once.
expectThat
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final <M extends Message> MultimapWithProtoValuesSubject<M> expectThat( Multimap<?, M> multimap) { return expect.about(ProtoTruth.protos()).that(multimap); }
Some tests don't vary across the different proto types, and should only be run once. <p>This method returns true for exactly one {@link TestType}, and false for all the others, and so can be used to ensure tests are only run once.
expectThat
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final ProtoSubject expectThatWithMessage(String msg, @Nullable Message message) { return expect.withMessage(msg).about(ProtoTruth.protos()).that(message); }
Some tests don't vary across the different proto types, and should only be run once. <p>This method returns true for exactly one {@link TestType}, and false for all the others, and so can be used to ensure tests are only run once.
expectThatWithMessage
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final void expectIsEqualToFailed() { expectFailureMatches( "Not true that messages compare equal\\.\\s*" + "(Differences were found:\\n.*|No differences were reported\\..*)"); }
Some tests don't vary across the different proto types, and should only be run once. <p>This method returns true for exactly one {@link TestType}, and false for all the others, and so can be used to ensure tests are only run once.
expectIsEqualToFailed
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final void expectIsNotEqualToFailed() { expectFailureMatches( "Not true that messages compare not equal\\.\\s*" + "(Only ignorable differences were found:\\n.*|" + "No differences were found\\..*)"); }
Some tests don't vary across the different proto types, and should only be run once. <p>This method returns true for exactly one {@link TestType}, and false for all the others, and so can be used to ensure tests are only run once.
expectIsNotEqualToFailed
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final void expectFailureMatches(String regex) { expectThatFailure().hasMessageThat().matches(Pattern.compile(regex, Pattern.DOTALL)); }
Expects the current {@link ExpectFailure} failure message to match the provided regex, using {@code Pattern.DOTALL} to match newlines.
expectFailureMatches
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected final void expectNoRegex(Throwable t, String regex) { expectThatFailure().hasMessageThat().doesNotMatch(Pattern.compile(regex, Pattern.DOTALL)); }
Expects the current {@link ExpectFailure} failure message to NOT match the provided regex, using {@code Pattern.DOTALL} to match newlines.
expectNoRegex
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected static final <T> ImmutableList<T> listOf(T... elements) { return ImmutableList.copyOf(elements); }
Expects the current {@link ExpectFailure} failure message to NOT match the provided regex, using {@code Pattern.DOTALL} to match newlines.
listOf
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0
protected static final <T> T[] arrayOf(T... elements) { return elements; }
Expects the current {@link ExpectFailure} failure message to NOT match the provided regex, using {@code Pattern.DOTALL} to match newlines.
arrayOf
java
google/truth
extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
https://github.com/google/truth/blob/master/extensions/proto/src/test/java/com/google/common/truth/extensions/proto/ProtoSubjectTestBase.java
Apache-2.0