M - the type of the message values in the mappublic class MapWithProtoValuesSubject<M extends Message> extends MapSubject
ProtoTruth.assertThat(actual).containsExactlyEntriesIn(expected) performs the same
 assertion as Truth.assertThat(actual).containsExactlyEntriesIn(expected). By default, the
 assertions are strict with respect to repeated field order, missing fields, etc. This behavior
 can be changed with the configuration methods on this subject, e.g. ProtoTruth.assertThat(actual).ignoringRepeatedFieldOrder().containsExactly(expected).
 
By default, floating-point fields are compared using exact equality, which is probably not what you want if the values are the
 results of some arithmetic. To check for approximate equality, use usingDoubleToleranceForValues(double), usingFloatToleranceForValues(float), and their per-field equivalents.
 
Equality tests, and other methods, may yield slightly different behavior for versions 2 and 3 of Protocol Buffers. If testing protos of multiple versions, make sure you understand the behaviors of default and unknown fields so you don't under or over test.
| Modifier | Constructor and Description | 
|---|---|
protected  | 
MapWithProtoValuesSubject(FailureMetadata failureMetadata,
                         Map<?,M> map)  | 
| Modifier and Type | Method and Description | 
|---|---|
MapWithProtoValuesFluentAssertion<M> | 
comparingExpectedFieldsOnlyForValues()
Limits the comparison of Protocol buffers to the fields set in the expected proto(s). 
 | 
MapWithProtoValuesFluentAssertion<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. 
 | 
MapWithProtoValuesFluentAssertion<M> | 
ignoringExtraRepeatedFieldElementsOfFieldDescriptorsForValues(Descriptors.FieldDescriptor firstFieldDescriptor,
                                                             Descriptors.FieldDescriptor... rest)
Specifies that extra repeated field elements for these explicitly specified field descriptors
 should be ignored. 
 | 
MapWithProtoValuesFluentAssertion<M> | 
ignoringExtraRepeatedFieldElementsOfFieldDescriptorsForValues(Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Specifies that extra repeated field elements for these explicitly specified field descriptors
 should be ignored. 
 | 
MapWithProtoValuesFluentAssertion<M> | 
ignoringExtraRepeatedFieldElementsOfFieldsForValues(int firstFieldNumber,
                                                   int... rest)
Specifies that extra repeated field elements for these explicitly specified top-level field
 numbers should be ignored. 
 | 
MapWithProtoValuesFluentAssertion<M> | 
ignoringExtraRepeatedFieldElementsOfFieldsForValues(Iterable<Integer> fieldNumbers)
Specifies that extra repeated field elements for these explicitly specified top-level field
 numbers should be ignored. 
 | 
MapWithProtoValuesFluentAssertion<M> | 
ignoringFieldAbsenceForValues()
Specifies that the 'has' bit of individual fields should be ignored when comparing for
 equality. 
 | 
MapWithProtoValuesFluentAssertion<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. 
 | 
MapWithProtoValuesFluentAssertion<M> | 
ignoringFieldAbsenceOfFieldDescriptorsForValues(Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Specifies that the 'has' bit of these explicitly specified field descriptors should be ignored
 when comparing for equality. 
 | 
MapWithProtoValuesFluentAssertion<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. 
 | 
MapWithProtoValuesFluentAssertion<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. 
 | 
MapWithProtoValuesFluentAssertion<M> | 
ignoringFieldDescriptorsForValues(Descriptors.FieldDescriptor firstFieldDescriptor,
                                 Descriptors.FieldDescriptor... rest)
Excludes all message fields matching the given  
Descriptors.FieldDescriptors from the comparison. | 
MapWithProtoValuesFluentAssertion<M> | 
ignoringFieldDescriptorsForValues(Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Excludes all message fields matching the given  
Descriptors.FieldDescriptors from the comparison. | 
MapWithProtoValuesFluentAssertion<M> | 
ignoringFieldScopeForValues(FieldScope fieldScope)
Excludes all specific field paths under the argument  
FieldScope from the comparison. | 
MapWithProtoValuesFluentAssertion<M> | 
ignoringFieldsForValues(int firstFieldNumber,
                       int... rest)
Excludes the top-level message fields with the given tag numbers from the comparison. 
 | 
MapWithProtoValuesFluentAssertion<M> | 
ignoringFieldsForValues(Iterable<Integer> fieldNumbers)
Excludes the top-level message fields with the given tag numbers from the comparison. 
 | 
MapWithProtoValuesFluentAssertion<M> | 
ignoringRepeatedFieldOrderForValues()
Specifies that the ordering of repeated fields, at all levels, should be ignored when comparing
 for equality. 
 | 
MapWithProtoValuesFluentAssertion<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. 
 | 
MapWithProtoValuesFluentAssertion<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. 
 | 
MapWithProtoValuesFluentAssertion<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. 
 | 
MapWithProtoValuesFluentAssertion<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. 
 | 
MapWithProtoValuesFluentAssertion<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. 
 | 
MapWithProtoValuesFluentAssertion<M> | 
usingDoubleToleranceForFieldDescriptorsForValues(double tolerance,
                                                Descriptors.FieldDescriptor firstFieldDescriptor,
                                                Descriptors.FieldDescriptor... rest)
Compares double fields with these explicitly specified fields using the provided absolute
 tolerance. 
 | 
MapWithProtoValuesFluentAssertion<M> | 
usingDoubleToleranceForFieldDescriptorsForValues(double tolerance,
                                                Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Compares double fields with these explicitly specified fields using the provided absolute
 tolerance. 
 | 
MapWithProtoValuesFluentAssertion<M> | 
usingDoubleToleranceForFieldsForValues(double tolerance,
                                      int firstFieldNumber,
                                      int... rest)
Compares double fields with these explicitly specified top-level field numbers using the
 provided absolute tolerance. 
 | 
MapWithProtoValuesFluentAssertion<M> | 
usingDoubleToleranceForFieldsForValues(double tolerance,
                                      Iterable<Integer> fieldNumbers)
Compares double fields with these explicitly specified top-level field numbers using the
 provided absolute tolerance. 
 | 
MapWithProtoValuesFluentAssertion<M> | 
usingDoubleToleranceForValues(double tolerance)
Compares double fields as equal if they are both finite and their absolute difference is less
 than or equal to  
tolerance. | 
MapWithProtoValuesFluentAssertion<M> | 
usingFloatToleranceForFieldDescriptorsForValues(float tolerance,
                                               Descriptors.FieldDescriptor firstFieldDescriptor,
                                               Descriptors.FieldDescriptor... rest)
Compares float fields with these explicitly specified fields using the provided absolute
 tolerance. 
 | 
MapWithProtoValuesFluentAssertion<M> | 
usingFloatToleranceForFieldDescriptorsForValues(float tolerance,
                                               Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Compares float fields with these explicitly specified top-level field numbers using the
 provided absolute tolerance. 
 | 
MapWithProtoValuesFluentAssertion<M> | 
usingFloatToleranceForFieldsForValues(float tolerance,
                                     int firstFieldNumber,
                                     int... rest)
Compares float fields with these explicitly specified top-level field numbers using the
 provided absolute tolerance. 
 | 
MapWithProtoValuesFluentAssertion<M> | 
usingFloatToleranceForFieldsForValues(float tolerance,
                                     Iterable<Integer> fieldNumbers)
Compares float fields with these explicitly specified top-level field numbers using the
 provided absolute tolerance. 
 | 
MapWithProtoValuesFluentAssertion<M> | 
usingFloatToleranceForValues(float tolerance)
Compares float fields as equal if they are both finite and their absolute difference is less
 than or equal to  
tolerance. | 
MapWithProtoValuesFluentAssertion<M> | 
withPartialScopeForValues(FieldScope fieldScope)
Limits the comparison of Protocol buffers to the defined  
FieldScope. | 
comparingValuesUsing, containsAtLeast, containsAtLeastEntriesIn, containsEntry, containsExactly, containsExactly, containsExactlyEntriesIn, containsKey, doesNotContainEntry, doesNotContainKey, hasSize, isEmpty, isEqualTo, isNotEmptyactualCustomStringRepresentation, check, equals, failWithActual, failWithActual, failWithoutActual, hashCode, ignoreCheck, isAnyOf, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameInstanceAs, isNull, isSameInstanceAs, toStringprotected MapWithProtoValuesSubject(FailureMetadata failureMetadata, @NullableDecl Map<?,M> map)
public MapWithProtoValuesFluentAssertion<M> ignoringFieldAbsenceForValues()
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.
public MapWithProtoValuesFluentAssertion<M> ignoringFieldAbsenceOfFieldsForValues(int firstFieldNumber, int... rest)
Descriptors.FieldDescriptor) if they are to be ignored as well.
 Use ignoringFieldAbsenceForValues() instead to ignore the 'has' bit for all fields.
for detailspublic MapWithProtoValuesFluentAssertion<M> ignoringFieldAbsenceOfFieldsForValues(Iterable<Integer> fieldNumbers)
Descriptors.FieldDescriptor) if they are to be ignored as well.
 Use ignoringFieldAbsenceForValues() instead to ignore the 'has' bit for all fields.
for detailspublic MapWithProtoValuesFluentAssertion<M> ignoringFieldAbsenceOfFieldDescriptorsForValues(Descriptors.FieldDescriptor firstFieldDescriptor, Descriptors.FieldDescriptor... rest)
Use ignoringFieldAbsenceForValues() instead to ignore the 'has' bit for all fields.
for detailspublic MapWithProtoValuesFluentAssertion<M> ignoringFieldAbsenceOfFieldDescriptorsForValues(Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Use ignoringFieldAbsenceForValues() instead to ignore the 'has' bit for all fields.
for detailspublic MapWithProtoValuesFluentAssertion<M> ignoringRepeatedFieldOrderForValues()
This setting applies to all repeated fields recursively, but it does not ignore structure.
 For example, with ignoringRepeatedFieldOrderForValues(), a repeated int32
 field bar, set inside a repeated message field foo, 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.
public MapWithProtoValuesFluentAssertion<M> ignoringRepeatedFieldOrderOfFieldsForValues(int firstFieldNumber, int... rest)
Descriptors.FieldDescriptor) if their orders are to be ignored as well.
 Use ignoringRepeatedFieldOrderForValues() instead to ignore order for all fields.
for details.public MapWithProtoValuesFluentAssertion<M> ignoringRepeatedFieldOrderOfFieldsForValues(Iterable<Integer> fieldNumbers)
Descriptors.FieldDescriptor) if their orders are to be ignored as well.
 Use ignoringRepeatedFieldOrderForValues() instead to ignore order for all fields.
for details.public MapWithProtoValuesFluentAssertion<M> ignoringRepeatedFieldOrderOfFieldDescriptorsForValues(Descriptors.FieldDescriptor firstFieldDescriptor, Descriptors.FieldDescriptor... rest)
Use ignoringRepeatedFieldOrderForValues() instead to ignore order for all fields.
for details.public MapWithProtoValuesFluentAssertion<M> ignoringRepeatedFieldOrderOfFieldDescriptorsForValues(Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Use ignoringRepeatedFieldOrderForValues() instead to ignore order for all fields.
for details.public MapWithProtoValuesFluentAssertion<M> ignoringExtraRepeatedFieldElementsForValues()
comparingExpectedFieldsOnlyForValues().
 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.)
public MapWithProtoValuesFluentAssertion<M> ignoringExtraRepeatedFieldElementsOfFieldsForValues(int firstFieldNumber, int... rest)
Descriptors.FieldDescriptor) if their extra elements are to be ignored as well.
 Use ignoringExtraRepeatedFieldElementsForValues() instead to ignore these for all
 fields.
for details.public MapWithProtoValuesFluentAssertion<M> ignoringExtraRepeatedFieldElementsOfFieldsForValues(Iterable<Integer> fieldNumbers)
Descriptors.FieldDescriptor) if their extra elements are to be ignored as well.
 Use ignoringExtraRepeatedFieldElementsForValues() instead to ignore these for all
 fields.
for details.public MapWithProtoValuesFluentAssertion<M> ignoringExtraRepeatedFieldElementsOfFieldDescriptorsForValues(Descriptors.FieldDescriptor firstFieldDescriptor, Descriptors.FieldDescriptor... rest)
Use ignoringExtraRepeatedFieldElementsForValues() instead to ignore these for all
 fields.
for details.public MapWithProtoValuesFluentAssertion<M> ignoringExtraRepeatedFieldElementsOfFieldDescriptorsForValues(Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Use ignoringExtraRepeatedFieldElementsForValues() instead to ignore these for all
 fields.
for details.public MapWithProtoValuesFluentAssertion<M> usingDoubleToleranceForValues(double tolerance)
tolerance.tolerance - A finite, non-negative tolerance.public MapWithProtoValuesFluentAssertion<M> usingDoubleToleranceForFieldsForValues(double tolerance, int firstFieldNumber, int... rest)
tolerance - A finite, non-negative tolerance.public MapWithProtoValuesFluentAssertion<M> usingDoubleToleranceForFieldsForValues(double tolerance, Iterable<Integer> fieldNumbers)
tolerance - A finite, non-negative tolerance.public MapWithProtoValuesFluentAssertion<M> usingDoubleToleranceForFieldDescriptorsForValues(double tolerance, Descriptors.FieldDescriptor firstFieldDescriptor, Descriptors.FieldDescriptor... rest)
tolerance - A finite, non-negative tolerance.public MapWithProtoValuesFluentAssertion<M> usingDoubleToleranceForFieldDescriptorsForValues(double tolerance, Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
tolerance - A finite, non-negative tolerance.public MapWithProtoValuesFluentAssertion<M> usingFloatToleranceForValues(float tolerance)
tolerance.tolerance - A finite, non-negative tolerance.public MapWithProtoValuesFluentAssertion<M> usingFloatToleranceForFieldsForValues(float tolerance, int firstFieldNumber, int... rest)
tolerance - A finite, non-negative tolerance.public MapWithProtoValuesFluentAssertion<M> usingFloatToleranceForFieldsForValues(float tolerance, Iterable<Integer> fieldNumbers)
tolerance - A finite, non-negative tolerance.public MapWithProtoValuesFluentAssertion<M> usingFloatToleranceForFieldDescriptorsForValues(float tolerance, Descriptors.FieldDescriptor firstFieldDescriptor, Descriptors.FieldDescriptor... rest)
tolerance - A finite, non-negative tolerance.public MapWithProtoValuesFluentAssertion<M> usingFloatToleranceForFieldDescriptorsForValues(float tolerance, Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
tolerance - A finite, non-negative tolerance.public MapWithProtoValuesFluentAssertion<M> comparingExpectedFieldsOnlyForValues()
The "expected proto(s)" are those passed to the method at the end of the call chain, such as
 MapSubject.containsEntry(java.lang.Object, java.lang.Object) or MapSubject.containsExactlyEntriesIn(java.util.Map<?, ?>).
 
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.
public MapWithProtoValuesFluentAssertion<M> withPartialScopeForValues(FieldScope fieldScope)
FieldScope.
 This method is additive and has well-defined ordering semantics. If the invoking ProtoFluentAssertion is already scoped to a FieldScope X, and this method is
 invoked with FieldScope Y, the resultant ProtoFluentAssertion is
 constrained to the intersection of FieldScopes X and Y.
 
By default, MapWithProtoValuesFluentAssertion is constrained to FieldScopes.all(), that is, no fields are excluded from comparison.
public MapWithProtoValuesFluentAssertion<M> ignoringFieldsForValues(int firstFieldNumber, int... rest)
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 type M will also have these field numbers
 ignored.
 
If an invalid field number is supplied, the terminal comparison operation will throw a runtime exception.
public MapWithProtoValuesFluentAssertion<M> ignoringFieldsForValues(Iterable<Integer> fieldNumbers)
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 type M will also have these field numbers
 ignored.
 
If an invalid field number is supplied, the terminal comparison operation will throw a runtime exception.
public MapWithProtoValuesFluentAssertion<M> ignoringFieldDescriptorsForValues(Descriptors.FieldDescriptor firstFieldDescriptor, Descriptors.FieldDescriptor... rest)
Descriptors.FieldDescriptors 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.
public MapWithProtoValuesFluentAssertion<M> ignoringFieldDescriptorsForValues(Iterable<Descriptors.FieldDescriptor> fieldDescriptors)
Descriptors.FieldDescriptors 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.
public MapWithProtoValuesFluentAssertion<M> ignoringFieldScopeForValues(FieldScope fieldScope)
FieldScope from the comparison.
 This method is additive and has well-defined ordering semantics. If the invoking ProtoFluentAssertion is already scoped to a FieldScope X, and this method is
 invoked with FieldScope Y, the resultant ProtoFluentAssertion is
 constrained to the subtraction of X - Y.
 
By default, ProtoFluentAssertion is constrained to FieldScopes.all(), that
 is, no fields are excluded from comparison.
public MapWithProtoValuesFluentAssertion<M> reportingMismatchesOnlyForValues()
This a purely cosmetic setting, and it has no effect on the behavior of the test.
Copyright © 2019. All rights reserved.