Interface MultimapWithProtoValuesFluentAssertion<M extends Message>
-
public interface MultimapWithProtoValuesFluentAssertion<M extends Message>
Fluent API to perform detailed, customizable comparison ofMultimap
s containing protocol buffers as values. The same comparison rules are applied to all pairs of protocol buffers which get compared.The keys of these maps are treated as ordinary objects, and keys which happen to be protocol buffers are not given special treatment. They are compared with
Object.equals(java.lang.Object)
andObject.hashCode()
as documented by theMultimap
interface.Methods may be chained in any order, but the chain should terminate with a method that doesn't return a
MultimapWithProtoValuesFluentAssertion
, such ascontainsExactlyEntriesIn(com.google.common.collect.Multimap<?, ? extends M>)
orcontainsEntry(java.lang.Object, M)
.The state of a
MultimapWithProtoValuesFluentAssertion
object after each method is called is left undefined. Users should not retain references toMultimapWithProtoValuesFluentAssertion
instances.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description MultimapWithProtoValuesFluentAssertion<M>
comparingExpectedFieldsOnlyForValues()
Limits the comparison of Protocol buffers to the fields set in the expected proto(s).void
containsEntry(@Nullable Object expectedKey, @Nullable M expectedValue)
Fails if the multimap does not contain an entry with the given key and a value that corresponds to the given value.Ordered
containsExactly()
Fails if the multimap is not empty.Ordered
containsExactly(@Nullable Object k0, @Nullable M v0, @Nullable Object... rest)
Fails if the multimap does not contain exactly the given set of key/value pairs.Ordered
containsExactlyEntriesIn(Multimap<?,? extends M> expectedMultimap)
Fails if the map does not contain exactly the keys in the given multimap, mapping to values that correspond to the values of the given multimap.void
doesNotContainEntry(@Nullable Object excludedKey, @Nullable M excludedValue)
Fails if the multimap contains an entry with the given key and a value that corresponds to the given value.boolean
equals(Object o)
Deprecated.Do not callequals()
on aMultimapWithProtoValuesFluentAssertion
.int
hashCode()
Deprecated.MultimapWithProtoValuesFluentAssertion
does not supporthashCode()
.MultimapWithProtoValuesFluentAssertion<M>
ignoringExtraRepeatedFieldElementsForValues()
Specifies that, for all repeated and map fields, any elements in the 'actual' proto which are not found in the 'expected' proto are ignored, with the exception of fields in the expected proto which are empty.MultimapWithProtoValuesFluentAssertion<M>
ignoringExtraRepeatedFieldElementsOfFieldDescriptorsForValues(Descriptors.FieldDescriptor firstFieldDescriptor, Descriptors.FieldDescriptor... rest)
Specifies that extra repeated field elements for these explicitly specified field descriptors should be ignored.MultimapWithProtoValuesFluentAssertion<M>
ignoringExtraRepeatedFieldElementsOfFieldDescriptorsForValues(Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Specifies that extra repeated field elements for these explicitly specified field descriptors should be ignored.MultimapWithProtoValuesFluentAssertion<M>
ignoringExtraRepeatedFieldElementsOfFieldsForValues(int firstFieldNumber, int... rest)
Specifies that extra repeated field elements for these explicitly specified top-level field numbers should be ignored.MultimapWithProtoValuesFluentAssertion<M>
ignoringExtraRepeatedFieldElementsOfFieldsForValues(Iterable<Integer> fieldNumbers)
Specifies that extra repeated field elements for these explicitly specified top-level field numbers should be ignored.MultimapWithProtoValuesFluentAssertion<M>
ignoringFieldAbsenceForValues()
Specifies that the 'has' bit of individual fields should be ignored when comparing for equality.MultimapWithProtoValuesFluentAssertion<M>
ignoringFieldAbsenceOfFieldDescriptorsForValues(Descriptors.FieldDescriptor firstFieldDescriptor, Descriptors.FieldDescriptor... rest)
Specifies that the 'has' bit of these explicitly specified field descriptors should be ignored when comparing for equality.MultimapWithProtoValuesFluentAssertion<M>
ignoringFieldAbsenceOfFieldDescriptorsForValues(Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Specifies that the 'has' bit of these explicitly specified field descriptors should be ignored when comparing for equality.MultimapWithProtoValuesFluentAssertion<M>
ignoringFieldAbsenceOfFieldsForValues(int firstFieldNumber, int... rest)
Specifies that the 'has' bit of these explicitly specified top-level field numbers should be ignored when comparing for equality.MultimapWithProtoValuesFluentAssertion<M>
ignoringFieldAbsenceOfFieldsForValues(Iterable<Integer> fieldNumbers)
Specifies that the 'has' bit of these explicitly specified top-level field numbers should be ignored when comparing for equality.MultimapWithProtoValuesFluentAssertion<M>
ignoringFieldDescriptorsForValues(Descriptors.FieldDescriptor firstFieldDescriptor, Descriptors.FieldDescriptor... rest)
Excludes all message fields matching the givenDescriptors.FieldDescriptor
s from the comparison.MultimapWithProtoValuesFluentAssertion<M>
ignoringFieldDescriptorsForValues(Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Excludes all message fields matching the givenDescriptors.FieldDescriptor
s from the comparison.MultimapWithProtoValuesFluentAssertion<M>
ignoringFieldScopeForValues(FieldScope fieldScope)
Excludes all specific field paths under the argumentFieldScope
from the comparison.MultimapWithProtoValuesFluentAssertion<M>
ignoringFieldsForValues(int firstFieldNumber, int... rest)
Excludes the top-level message fields with the given tag numbers from the comparison.MultimapWithProtoValuesFluentAssertion<M>
ignoringFieldsForValues(Iterable<Integer> fieldNumbers)
Excludes the top-level message fields with the given tag numbers from the comparison.MultimapWithProtoValuesFluentAssertion<M>
ignoringRepeatedFieldOrderForValues()
Specifies that the ordering of repeated fields, at all levels, should be ignored when comparing for equality.MultimapWithProtoValuesFluentAssertion<M>
ignoringRepeatedFieldOrderOfFieldDescriptorsForValues(Descriptors.FieldDescriptor firstFieldDescriptor, Descriptors.FieldDescriptor... rest)
Specifies that the ordering of repeated fields for these explicitly specified field descriptors should be ignored when comparing for equality.MultimapWithProtoValuesFluentAssertion<M>
ignoringRepeatedFieldOrderOfFieldDescriptorsForValues(Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Specifies that the ordering of repeated fields for these explicitly specified field descriptors should be ignored when comparing for equality.MultimapWithProtoValuesFluentAssertion<M>
ignoringRepeatedFieldOrderOfFieldsForValues(int firstFieldNumber, int... rest)
Specifies that the ordering of repeated fields for these explicitly specified top-level field numbers should be ignored when comparing for equality.MultimapWithProtoValuesFluentAssertion<M>
ignoringRepeatedFieldOrderOfFieldsForValues(Iterable<Integer> fieldNumbers)
Specifies that the ordering of repeated fields for these explicitly specified top-level field numbers should be ignored when comparing for equality.MultimapWithProtoValuesFluentAssertion<M>
reportingMismatchesOnlyForValues()
If set, in the event of a comparison failure, the error message printed will list only those specific fields that did not match between the actual and expected values.MultimapWithProtoValuesFluentAssertion<M>
unpackingAnyUsingForValues(TypeRegistry typeRegistry, ExtensionRegistry extensionRegistry)
MultimapWithProtoValuesFluentAssertion<M>
usingDoubleToleranceForFieldDescriptorsForValues(double tolerance, Descriptors.FieldDescriptor firstFieldDescriptor, Descriptors.FieldDescriptor... rest)
Compares double fields with these explicitly specified fields using the provided absolute tolerance.MultimapWithProtoValuesFluentAssertion<M>
usingDoubleToleranceForFieldDescriptorsForValues(double tolerance, Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Compares double fields with these explicitly specified fields using the provided absolute tolerance.MultimapWithProtoValuesFluentAssertion<M>
usingDoubleToleranceForFieldsForValues(double tolerance, int firstFieldNumber, int... rest)
Compares double fields with these explicitly specified top-level field numbers using the provided absolute tolerance.MultimapWithProtoValuesFluentAssertion<M>
usingDoubleToleranceForFieldsForValues(double tolerance, Iterable<Integer> fieldNumbers)
Compares double fields with these explicitly specified top-level field numbers using the provided absolute tolerance.MultimapWithProtoValuesFluentAssertion<M>
usingDoubleToleranceForValues(double tolerance)
Compares double fields as equal if they are both finite and their absolute difference is less than or equal totolerance
.MultimapWithProtoValuesFluentAssertion<M>
usingFloatToleranceForFieldDescriptorsForValues(float tolerance, Descriptors.FieldDescriptor firstFieldDescriptor, Descriptors.FieldDescriptor... rest)
Compares float fields with these explicitly specified fields using the provided absolute tolerance.MultimapWithProtoValuesFluentAssertion<M>
usingFloatToleranceForFieldDescriptorsForValues(float tolerance, Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Compares float fields with these explicitly specified top-level field numbers using the provided absolute tolerance.MultimapWithProtoValuesFluentAssertion<M>
usingFloatToleranceForFieldsForValues(float tolerance, int firstFieldNumber, int... rest)
Compares float fields with these explicitly specified top-level field numbers using the provided absolute tolerance.MultimapWithProtoValuesFluentAssertion<M>
usingFloatToleranceForFieldsForValues(float tolerance, Iterable<Integer> fieldNumbers)
Compares float fields with these explicitly specified top-level field numbers using the provided absolute tolerance.MultimapWithProtoValuesFluentAssertion<M>
usingFloatToleranceForValues(float tolerance)
Compares float fields as equal if they are both finite and their absolute difference is less than or equal totolerance
.MultimapWithProtoValuesFluentAssertion<M>
withPartialScopeForValues(FieldScope fieldScope)
Limits the comparison of Protocol buffers to the definedFieldScope
.
-
-
-
Method Detail
-
ignoringFieldAbsenceForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringFieldAbsenceForValues()
Specifies that the 'has' bit of individual fields should be ignored when comparing for equality.For version 2 Protocol Buffers, this setting determines whether two protos with the same value for a field compare equal if one explicitly sets the value, and the other merely implicitly uses the schema-defined default. This setting also determines whether unknown fields should be considered in the comparison. By
ignoringFieldAbsence()
, unknown fields are ignored, and value-equal fields as specified above are considered equal.For version 3 Protocol Buffers, this setting does not affect primitive fields, because their default value is indistinguishable from unset.
-
ignoringFieldAbsenceOfFieldsForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringFieldAbsenceOfFieldsForValues(int firstFieldNumber, int... rest)
Specifies that the 'has' bit of these explicitly specified top-level field numbers should be ignored when comparing for equality. Sub-fields must be specified explicitly (viaDescriptors.FieldDescriptor
) if they are to be ignored as well.Use
ignoringFieldAbsenceForValues()
instead to ignore the 'has' bit for all fields.- See Also:
for details
-
ignoringFieldAbsenceOfFieldsForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringFieldAbsenceOfFieldsForValues(Iterable<Integer> fieldNumbers)
Specifies that the 'has' bit of these explicitly specified top-level field numbers should be ignored when comparing for equality. Sub-fields must be specified explicitly (viaDescriptors.FieldDescriptor
) if they are to be ignored as well.Use
ignoringFieldAbsenceForValues()
instead to ignore the 'has' bit for all fields.- See Also:
for details
-
ignoringFieldAbsenceOfFieldDescriptorsForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringFieldAbsenceOfFieldDescriptorsForValues(Descriptors.FieldDescriptor firstFieldDescriptor, Descriptors.FieldDescriptor... rest)
Specifies that the 'has' bit of these explicitly specified field descriptors should be ignored when comparing for equality. Sub-fields must be specified explicitly if they are to be ignored as well.Use
ignoringFieldAbsenceForValues()
instead to ignore the 'has' bit for all fields.- See Also:
for details
-
ignoringFieldAbsenceOfFieldDescriptorsForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringFieldAbsenceOfFieldDescriptorsForValues(Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Specifies that the 'has' bit of these explicitly specified field descriptors should be ignored when comparing for equality. Sub-fields must be specified explicitly if they are to be ignored as well.Use
ignoringFieldAbsenceForValues()
instead to ignore the 'has' bit for all fields.- See Also:
for details
-
ignoringRepeatedFieldOrderForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringRepeatedFieldOrderForValues()
Specifies that the ordering of repeated fields, at all levels, should be ignored when comparing for equality.This setting applies to all repeated fields recursively, but it does not ignore structure. For example, with
ignoringRepeatedFieldOrderForValues()
, a repeatedint32
fieldbar
, set inside a repeated message fieldfoo
, the following protos will all compare equal:message1: { foo: { bar: 1 bar: 2 } foo: { bar: 3 bar: 4 } } message2: { foo: { bar: 2 bar: 1 } foo: { bar: 4 bar: 3 } } message3: { foo: { bar: 4 bar: 3 } foo: { bar: 2 bar: 1 } }
However, the following message will compare equal to none of these:
message4: { foo: { bar: 1 bar: 3 } foo: { bar: 2 bar: 4 } }
This setting does not apply to map fields, for which field order is always ignored. The serialization order of map fields is undefined, and it may change from runtime to runtime.
-
ignoringRepeatedFieldOrderOfFieldsForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringRepeatedFieldOrderOfFieldsForValues(int firstFieldNumber, int... rest)
Specifies that the ordering of repeated fields for these explicitly specified top-level field numbers should be ignored when comparing for equality. Sub-fields must be specified explicitly (viaDescriptors.FieldDescriptor
) if their orders are to be ignored as well.Use
ignoringRepeatedFieldOrderForValues()
instead to ignore order for all fields.- See Also:
for details.
-
ignoringRepeatedFieldOrderOfFieldsForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringRepeatedFieldOrderOfFieldsForValues(Iterable<Integer> fieldNumbers)
Specifies that the ordering of repeated fields for these explicitly specified top-level field numbers should be ignored when comparing for equality. Sub-fields must be specified explicitly (viaDescriptors.FieldDescriptor
) if their orders are to be ignored as well.Use
ignoringRepeatedFieldOrderForValues()
instead to ignore order for all fields.- See Also:
for details.
-
ignoringRepeatedFieldOrderOfFieldDescriptorsForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringRepeatedFieldOrderOfFieldDescriptorsForValues(Descriptors.FieldDescriptor firstFieldDescriptor, Descriptors.FieldDescriptor... rest)
Specifies that the ordering of repeated fields for these explicitly specified field descriptors should be ignored when comparing for equality. Sub-fields must be specified explicitly if their orders are to be ignored as well.Use
ignoringRepeatedFieldOrderForValues()
instead to ignore order for all fields.- See Also:
for details.
-
ignoringRepeatedFieldOrderOfFieldDescriptorsForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringRepeatedFieldOrderOfFieldDescriptorsForValues(Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Specifies that the ordering of repeated fields for these explicitly specified field descriptors should be ignored when comparing for equality. Sub-fields must be specified explicitly if their orders are to be ignored as well.Use
ignoringRepeatedFieldOrderForValues()
instead to ignore order for all fields.- See Also:
for details.
-
ignoringExtraRepeatedFieldElementsForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringExtraRepeatedFieldElementsForValues()
Specifies that, for all repeated and map fields, any elements in the 'actual' proto which are not found in the 'expected' proto are ignored, with the exception of fields in the expected proto which are empty. To ignore empty repeated fields as well, usecomparingExpectedFieldsOnlyForValues()
.This rule is applied independently from
ignoringRepeatedFieldOrderForValues()
. If ignoring repeated field order AND extra repeated field elements, all that is tested is that the expected elements comprise a subset of the actual elements. If not ignoring repeated field order, but still ignoring extra repeated field elements, the actual elements must contain a subsequence that matches the expected elements for the test to pass. (The subsequence rule does not apply to Map fields, which are always compared by key.)
-
ignoringExtraRepeatedFieldElementsOfFieldsForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringExtraRepeatedFieldElementsOfFieldsForValues(int firstFieldNumber, int... rest)
Specifies that extra repeated field elements for these explicitly specified top-level field numbers should be ignored. Sub-fields must be specified explicitly (viaDescriptors.FieldDescriptor
) if their extra elements are to be ignored as well.Use
ignoringExtraRepeatedFieldElementsForValues()
instead to ignore these for all fields.- See Also:
for details.
-
ignoringExtraRepeatedFieldElementsOfFieldsForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringExtraRepeatedFieldElementsOfFieldsForValues(Iterable<Integer> fieldNumbers)
Specifies that extra repeated field elements for these explicitly specified top-level field numbers should be ignored. Sub-fields must be specified explicitly (viaDescriptors.FieldDescriptor
) if their extra elements are to be ignored as well.Use
ignoringExtraRepeatedFieldElementsForValues()
instead to ignore these for all fields.- See Also:
for details.
-
ignoringExtraRepeatedFieldElementsOfFieldDescriptorsForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringExtraRepeatedFieldElementsOfFieldDescriptorsForValues(Descriptors.FieldDescriptor firstFieldDescriptor, Descriptors.FieldDescriptor... rest)
Specifies that extra repeated field elements for these explicitly specified field descriptors should be ignored. Sub-fields must be specified explicitly if their extra elements are to be ignored as well.Use
ignoringExtraRepeatedFieldElementsForValues()
instead to ignore these for all fields.- See Also:
for details.
-
ignoringExtraRepeatedFieldElementsOfFieldDescriptorsForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringExtraRepeatedFieldElementsOfFieldDescriptorsForValues(Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Specifies that extra repeated field elements for these explicitly specified field descriptors should be ignored. Sub-fields must be specified explicitly if their extra elements are to be ignored as well.Use
ignoringExtraRepeatedFieldElementsForValues()
instead to ignore these for all fields.- See Also:
for details.
-
usingDoubleToleranceForValues
MultimapWithProtoValuesFluentAssertion<M> usingDoubleToleranceForValues(double tolerance)
Compares double fields as equal if they are both finite and their absolute difference is less than or equal totolerance
.- Parameters:
tolerance
- A finite, non-negative tolerance.
-
usingDoubleToleranceForFieldsForValues
MultimapWithProtoValuesFluentAssertion<M> usingDoubleToleranceForFieldsForValues(double tolerance, int firstFieldNumber, int... rest)
Compares double fields with these explicitly specified top-level field numbers using the provided absolute tolerance.- Parameters:
tolerance
- A finite, non-negative tolerance.
-
usingDoubleToleranceForFieldsForValues
MultimapWithProtoValuesFluentAssertion<M> usingDoubleToleranceForFieldsForValues(double tolerance, Iterable<Integer> fieldNumbers)
Compares double fields with these explicitly specified top-level field numbers using the provided absolute tolerance.- Parameters:
tolerance
- A finite, non-negative tolerance.
-
usingDoubleToleranceForFieldDescriptorsForValues
MultimapWithProtoValuesFluentAssertion<M> usingDoubleToleranceForFieldDescriptorsForValues(double tolerance, Descriptors.FieldDescriptor firstFieldDescriptor, Descriptors.FieldDescriptor... rest)
Compares double fields with these explicitly specified fields using the provided absolute tolerance.- Parameters:
tolerance
- A finite, non-negative tolerance.
-
usingDoubleToleranceForFieldDescriptorsForValues
MultimapWithProtoValuesFluentAssertion<M> usingDoubleToleranceForFieldDescriptorsForValues(double tolerance, Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Compares double fields with these explicitly specified fields using the provided absolute tolerance.- Parameters:
tolerance
- A finite, non-negative tolerance.
-
usingFloatToleranceForValues
MultimapWithProtoValuesFluentAssertion<M> usingFloatToleranceForValues(float tolerance)
Compares float fields as equal if they are both finite and their absolute difference is less than or equal totolerance
.- Parameters:
tolerance
- A finite, non-negative tolerance.
-
usingFloatToleranceForFieldsForValues
MultimapWithProtoValuesFluentAssertion<M> usingFloatToleranceForFieldsForValues(float tolerance, int firstFieldNumber, int... rest)
Compares float fields with these explicitly specified top-level field numbers using the provided absolute tolerance.- Parameters:
tolerance
- A finite, non-negative tolerance.
-
usingFloatToleranceForFieldsForValues
MultimapWithProtoValuesFluentAssertion<M> usingFloatToleranceForFieldsForValues(float tolerance, Iterable<Integer> fieldNumbers)
Compares float fields with these explicitly specified top-level field numbers using the provided absolute tolerance.- Parameters:
tolerance
- A finite, non-negative tolerance.
-
usingFloatToleranceForFieldDescriptorsForValues
MultimapWithProtoValuesFluentAssertion<M> usingFloatToleranceForFieldDescriptorsForValues(float tolerance, Descriptors.FieldDescriptor firstFieldDescriptor, Descriptors.FieldDescriptor... rest)
Compares float fields with these explicitly specified fields using the provided absolute tolerance.- Parameters:
tolerance
- A finite, non-negative tolerance.
-
usingFloatToleranceForFieldDescriptorsForValues
MultimapWithProtoValuesFluentAssertion<M> usingFloatToleranceForFieldDescriptorsForValues(float tolerance, Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Compares float fields with these explicitly specified top-level field numbers using the provided absolute tolerance.- Parameters:
tolerance
- A finite, non-negative tolerance.
-
comparingExpectedFieldsOnlyForValues
MultimapWithProtoValuesFluentAssertion<M> comparingExpectedFieldsOnlyForValues()
Limits the comparison of Protocol buffers to the fields set in the expected proto(s). When multiple protos are specified, the comparison is limited to the union of set fields in all the expected protos.The "expected proto(s)" are those passed to the method at the end of the call chain, such as
containsEntry(java.lang.Object, M)
orcontainsExactlyEntriesIn(com.google.common.collect.Multimap<?, ? extends M>)
.Fields not set in the expected proto(s) are ignored. In particular, proto3 fields which have their default values are ignored, as these are indistinguishable from unset fields. If you want to assert that a proto3 message has certain fields with default values, you cannot use this method.
-
withPartialScopeForValues
MultimapWithProtoValuesFluentAssertion<M> withPartialScopeForValues(FieldScope fieldScope)
Limits the comparison of Protocol buffers to the definedFieldScope
.This method is additive and has well-defined ordering semantics. If the invoking
MultimapWithProtoValuesFluentAssertion
is already scoped to aFieldScope
X
, and this method is invoked withFieldScope
Y
, the resultantMultimapWithProtoValuesFluentAssertion
is constrained to the intersection ofFieldScope
sX
andY
.By default,
MultimapWithProtoValuesFluentAssertion
is constrained toFieldScopes.all()
, that is, no fields are excluded from comparison.
-
ignoringFieldsForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringFieldsForValues(int firstFieldNumber, int... rest)
Excludes the top-level message fields with the given tag numbers from the comparison.This method adds on any previous
FieldScope
related settings, overriding previous changes to ensure the specified fields are ignored recursively. All sub-fields of these field numbers are ignored, and all sub-messages of typeM
will also have these field numbers ignored.If an invalid field number is supplied, the terminal comparison operation will throw a runtime exception.
-
ignoringFieldsForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringFieldsForValues(Iterable<Integer> fieldNumbers)
Excludes the top-level message fields with the given tag numbers from the comparison.This method adds on any previous
FieldScope
related settings, overriding previous changes to ensure the specified fields are ignored recursively. All sub-fields of these field numbers are ignored, and all sub-messages of typeM
will also have these field numbers ignored.If an invalid field number is supplied, the terminal comparison operation will throw a runtime exception.
-
ignoringFieldDescriptorsForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringFieldDescriptorsForValues(Descriptors.FieldDescriptor firstFieldDescriptor, Descriptors.FieldDescriptor... rest)
Excludes all message fields matching the givenDescriptors.FieldDescriptor
s from the comparison.This method adds on any previous
FieldScope
related settings, overriding previous changes to ensure the specified fields are ignored recursively. All sub-fields of these field descriptors are ignored, no matter where they occur in the tree.If a field descriptor which does not, or cannot occur in the proto structure is supplied, it is silently ignored.
-
ignoringFieldDescriptorsForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringFieldDescriptorsForValues(Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Excludes all message fields matching the givenDescriptors.FieldDescriptor
s from the comparison.This method adds on any previous
FieldScope
related settings, overriding previous changes to ensure the specified fields are ignored recursively. All sub-fields of these field descriptors are ignored, no matter where they occur in the tree.If a field descriptor which does not, or cannot occur in the proto structure is supplied, it is silently ignored.
-
ignoringFieldScopeForValues
MultimapWithProtoValuesFluentAssertion<M> ignoringFieldScopeForValues(FieldScope fieldScope)
Excludes all specific field paths under the argumentFieldScope
from the comparison.This method is additive and has well-defined ordering semantics. If the invoking
MultimapWithProtoValuesFluentAssertion
is already scoped to aFieldScope
X
, and this method is invoked withFieldScope
Y
, the resultantMultimapWithProtoValuesFluentAssertion
is constrained to the subtraction ofX - Y
.By default,
MultimapWithProtoValuesFluentAssertion
is constrained toFieldScopes.all()
, that is, no fields are excluded from comparison.
-
reportingMismatchesOnlyForValues
MultimapWithProtoValuesFluentAssertion<M> reportingMismatchesOnlyForValues()
If set, in the event of a comparison failure, the error message printed will list only those specific fields that did not match between the actual and expected values. Useful for very large protocol buffers.This a purely cosmetic setting, and it has no effect on the behavior of the test.
-
unpackingAnyUsingForValues
MultimapWithProtoValuesFluentAssertion<M> unpackingAnyUsingForValues(TypeRegistry typeRegistry, ExtensionRegistry extensionRegistry)
Specifies theTypeRegistry
andExtensionRegistry
to use forAny
messages.To compare the value of an
Any
message, ProtoTruth looks in the given type registry for a descriptor for the message's type URL:- If ProtoTruth finds a descriptor, it unpacks the value and compares it against the expected value, respecting any configuration methods used for the assertion.
- If ProtoTruth does not find a descriptor (or if the value can't be deserialized with the descriptor), it compares the raw, serialized bytes of the expected and actual values.
When ProtoTruth unpacks a value, it is parsing a serialized proto. That proto may contain extensions. To look up those extensions, ProtoTruth uses the provided
ExtensionRegistry
.- Since:
- 1.1
-
containsEntry
void containsEntry(@Nullable Object expectedKey, @Nullable M expectedValue)
Fails if the multimap does not contain an entry with the given key and a value that corresponds to the given value.
-
doesNotContainEntry
void doesNotContainEntry(@Nullable Object excludedKey, @Nullable M excludedValue)
Fails if the multimap contains an entry with the given key and a value that corresponds to the given value.
-
containsExactlyEntriesIn
@CanIgnoreReturnValue Ordered containsExactlyEntriesIn(Multimap<?,? extends M> expectedMultimap)
Fails if the map does not contain exactly the keys in the given multimap, mapping to values that correspond to the values of the given multimap.A subsequent call to
Ordered.inOrder()
may be made if the caller wishes to verify that the two Multimaps iterate fully in the same order. That is, their key sets iterate in the same order, and the corresponding value collections for each key iterate in the same order.
-
containsExactly
@CanIgnoreReturnValue Ordered containsExactly()
Fails if the multimap is not empty.
-
containsExactly
@CanIgnoreReturnValue Ordered containsExactly(@Nullable Object k0, @Nullable M v0, @Nullable Object... rest)
Fails if the multimap does not contain exactly the given set of key/value pairs.Warning: the use of varargs means that we cannot guarantee an equal number of key/value pairs at compile time. Please make sure you provide varargs in key/value pairs!
-
equals
@Deprecated boolean equals(Object o)
Deprecated.Do not callequals()
on aMultimapWithProtoValuesFluentAssertion
.- Overrides:
equals
in classObject
- See Also:
Subject.equals(Object)
-
hashCode
@Deprecated int hashCode()
Deprecated.MultimapWithProtoValuesFluentAssertion
does not supporthashCode()
.- Overrides:
hashCode
in classObject
- See Also:
Subject.hashCode()
-
-