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 |
|---|---|---|---|---|---|---|---|
@Override
public String toString() {
return String.format("(%s || %s)", elements.get(0), elements.get(1));
}
|
Helper to produce a new {@code CompoundFieldScopeLogic} of the same type as the subclass.
|
toString
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
|
Apache-2.0
|
@Override
NegationFieldScopeLogic newLogicOfSameType(List<FieldScopeLogic> newElements) {
checkArgument(newElements.size() == 1, "Expected 1 element: %s", newElements);
return new NegationFieldScopeLogic(newElements.get(0));
}
|
Helper to produce a new {@code CompoundFieldScopeLogic} of the same type as the subclass.
|
newLogicOfSameType
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
|
Apache-2.0
|
@Override
FieldScopeResult policyFor(Descriptor rootDescriptor, SubScopeId subScopeId) {
FieldScopeResult result = elements.get(0).policyFor(rootDescriptor, subScopeId);
return FieldScopeResult.of(!result.included(), result.recursive());
}
|
Helper to produce a new {@code CompoundFieldScopeLogic} of the same type as the subclass.
|
policyFor
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
|
Apache-2.0
|
@Override
public String toString() {
return String.format("!(%s)", elements.get(0));
}
|
Helper to produce a new {@code CompoundFieldScopeLogic} of the same type as the subclass.
|
toString
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
|
Apache-2.0
|
static FieldScopeLogic and(FieldScopeLogic fieldScopeLogic1, FieldScopeLogic fieldScopeLogic2) {
return new IntersectionFieldScopeLogic(fieldScopeLogic1, fieldScopeLogic2);
}
|
Helper to produce a new {@code CompoundFieldScopeLogic} of the same type as the subclass.
|
and
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
|
Apache-2.0
|
static FieldScopeLogic or(FieldScopeLogic fieldScopeLogic1, FieldScopeLogic fieldScopeLogic2) {
return new UnionFieldScopeLogic(fieldScopeLogic1, fieldScopeLogic2);
}
|
Helper to produce a new {@code CompoundFieldScopeLogic} of the same type as the subclass.
|
or
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
|
Apache-2.0
|
static FieldScopeLogic not(FieldScopeLogic fieldScopeLogic) {
return new NegationFieldScopeLogic(fieldScopeLogic);
}
|
Helper to produce a new {@code CompoundFieldScopeLogic} of the same type as the subclass.
|
not
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogic.java
|
Apache-2.0
|
static <V> Entry<V> of(FieldScopeLogic fieldScopeLogic, V value) {
return new AutoValue_FieldScopeLogicMap_Entry<>(fieldScopeLogic, value);
}
|
An immutable map of {@link FieldScopeLogic} to an arbitrary value type.
<p>This is the field-path based analog to {@link com.google.common.collect.RangeMap}. Setting a
value {@code v} for a {@link FieldScopeLogic} {@code l} on the {@code FieldScopeLogicMap} means
that, for any field path {@code f} contained in {@code l}, the value mapped to {@code f} is
{@code v}. This overrides any previous {FieldScopeLogic -> value} pairs/mappings.
<p>Unlike {@link com.google.common.collect.RangeMap}, this class does not support analysis of its
internals, only {@link #get} operations, and it is not performant. All {@code get} and {@code
with} operations are O(N), where N = number of mappings, so this class is intended only for small
numbers of entries.
|
of
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java
|
Apache-2.0
|
public boolean isEmpty() {
return entries.isEmpty();
}
|
An immutable map of {@link FieldScopeLogic} to an arbitrary value type.
<p>This is the field-path based analog to {@link com.google.common.collect.RangeMap}. Setting a
value {@code v} for a {@link FieldScopeLogic} {@code l} on the {@code FieldScopeLogicMap} means
that, for any field path {@code f} contained in {@code l}, the value mapped to {@code f} is
{@code v}. This overrides any previous {FieldScopeLogic -> value} pairs/mappings.
<p>Unlike {@link com.google.common.collect.RangeMap}, this class does not support analysis of its
internals, only {@link #get} operations, and it is not performant. All {@code get} and {@code
with} operations are O(N), where N = number of mappings, so this class is intended only for small
numbers of entries.
|
isEmpty
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java
|
Apache-2.0
|
public Optional<V> get(Descriptor rootDescriptor, SubScopeId subScopeId) {
// Earlier entries override later ones, so we don't need to iterate backwards.
for (Entry<V> entry : entries) {
if (entry.fieldScopeLogic().contains(rootDescriptor, subScopeId)) {
return Optional.of(entry.value());
}
}
return Optional.absent();
}
|
An immutable map of {@link FieldScopeLogic} to an arbitrary value type.
<p>This is the field-path based analog to {@link com.google.common.collect.RangeMap}. Setting a
value {@code v} for a {@link FieldScopeLogic} {@code l} on the {@code FieldScopeLogicMap} means
that, for any field path {@code f} contained in {@code l}, the value mapped to {@code f} is
{@code v}. This overrides any previous {FieldScopeLogic -> value} pairs/mappings.
<p>Unlike {@link com.google.common.collect.RangeMap}, this class does not support analysis of its
internals, only {@link #get} operations, and it is not performant. All {@code get} and {@code
with} operations are O(N), where N = number of mappings, so this class is intended only for small
numbers of entries.
|
get
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java
|
Apache-2.0
|
public FieldScopeLogicMap<V> with(FieldScopeLogic fieldScopeLogic, V value) {
ImmutableList.Builder<Entry<V>> newEntries = ImmutableList.builder();
// Earlier entries override later ones, so we insert the new one at the front of the list.
newEntries.add(Entry.of(fieldScopeLogic, value));
newEntries.addAll(entries);
return new FieldScopeLogicMap<>(newEntries.build());
}
|
Returns a new immutable map that adds the given fields -> value mapping.
|
with
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java
|
Apache-2.0
|
@Override
public FieldScopeLogicMap<V> subScope(Descriptor rootDescriptor, SubScopeId subScopeId) {
ImmutableList.Builder<Entry<V>> newEntries =
ImmutableList.builderWithExpectedSize(entries.size());
for (Entry<V> entry : entries) {
newEntries.add(
Entry.of(entry.fieldScopeLogic().subScope(rootDescriptor, subScopeId), entry.value()));
}
return new FieldScopeLogicMap<>(newEntries.build());
}
|
Returns a new immutable map that adds the given fields -> value mapping.
|
subScope
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java
|
Apache-2.0
|
@Override
public void validate(
Descriptor rootDescriptor, FieldDescriptorValidator fieldDescriptorValidator) {
for (Entry<V> entry : entries) {
entry.fieldScopeLogic().validate(rootDescriptor, fieldDescriptorValidator);
}
}
|
Returns a new immutable map that adds the given fields -> value mapping.
|
validate
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java
|
Apache-2.0
|
@SuppressWarnings("unchecked") // Implementation is fully variant.
public static <V> FieldScopeLogicMap<V> empty() {
return (FieldScopeLogicMap<V>) EMPTY_INSTANCE;
}
|
Returns a new immutable map that adds the given fields -> value mapping.
|
empty
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java
|
Apache-2.0
|
public static <V> FieldScopeLogicMap<V> defaultValue(V value) {
return new FieldScopeLogicMap<>(ImmutableList.of(Entry.of(FieldScopeLogic.all(), value)));
}
|
Returns a map which maps all fields to the given value by default.
|
defaultValue
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeLogicMap.java
|
Apache-2.0
|
public static FieldScopeResult of(boolean included, boolean recursively) {
if (included) {
return recursively ? INCLUDED_RECURSIVELY : INCLUDED_NONRECURSIVELY;
} else {
return recursively ? EXCLUDED_RECURSIVELY : EXCLUDED_NONRECURSIVELY;
}
}
|
This field and all its children are excluded from the scope.
|
of
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeResult.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeResult.java
|
Apache-2.0
|
boolean included() {
return included;
}
|
Whether this field should be included or not.
|
included
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeResult.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeResult.java
|
Apache-2.0
|
boolean recursive() {
return recursive;
}
|
Whether this field's sub-children should also be unilaterally included or excluded, conditional
on {@link #included()}
|
recursive
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeResult.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeResult.java
|
Apache-2.0
|
public static FieldScope fromSetFields(
Message firstMessage, Message secondMessage, Message... rest) {
return fromSetFields(asList(firstMessage, secondMessage, rest));
}
|
Creates a {@link FieldScope} covering the fields set in every message in the provided list of
messages, with the same semantics as in {@link #fromSetFields(Message)}.
<p>This can be thought of as the union of the {@link FieldScope}s for each individual message,
or the {@link FieldScope} for the merge of all the messages. These are equivalent.
|
fromSetFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
Apache-2.0
|
public static FieldScope fromSetFields(Iterable<? extends Message> messages) {
return fromSetFields(
messages, AnyUtils.defaultTypeRegistry(), AnyUtils.defaultExtensionRegistry());
}
|
Creates a {@link FieldScope} covering the fields set in every message in the provided list of
messages, with the same semantics as in {@link #fromSetFields(Message)}.
<p>This can be thought of as the union of the {@link FieldScope}s for each individual message,
or the {@link FieldScope} for the merge of all the messages. These are equivalent.
|
fromSetFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
Apache-2.0
|
public static FieldScope fromSetFields(
Iterable<? extends Message> messages,
TypeRegistry typeRegistry,
ExtensionRegistry extensionRegistry) {
return FieldScopeImpl.createFromSetFields(messages, typeRegistry, extensionRegistry);
}
|
Creates a {@link FieldScope} covering the fields set in every message in the provided list of
messages, with the same semantics as in {@link #fromSetFields(Message)}.
<p>This can be thought of as the union of the {@link FieldScope}s for each individual message,
or the {@link FieldScope} for the merge of all the messages. These are equivalent.
<p>If there are {@code google.protobuf.Any} protos anywhere within these messages, they will be
unpacked using the provided {@link TypeRegistry} and {@link ExtensionRegistry} to determine
which fields within them should be compared.
@see ProtoFluentAssertion#unpackingAnyUsing
@since 1.2
|
fromSetFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
Apache-2.0
|
public static FieldScope ignoringFields(int firstFieldNumber, int... rest) {
return FieldScopeImpl.createIgnoringFields(asList(firstFieldNumber, rest));
}
|
Returns a {@link FieldScope} which matches everything except the provided field numbers for the
top level message type.
<p>The field numbers are ignored recursively on this type. That is, if {@code YourMessage}
contains another {@code YourMessage} somewhere within its subtree, field number {@code X} will
be ignored for all submessages of type {@code YourMessage}, as well as for the top-level
message.
@see FieldScope#ignoringFields(int, int...)
|
ignoringFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
Apache-2.0
|
public static FieldScope ignoringFields(Iterable<Integer> fieldNumbers) {
return FieldScopeImpl.createIgnoringFields(fieldNumbers);
}
|
Returns a {@link FieldScope} which matches everything except the provided field numbers for the
top level message type.
<p>The field numbers are ignored recursively on this type. That is, if {@code YourMessage}
contains another {@code YourMessage} somewhere within its subtree, field number {@code X} will
be ignored for all submessages of type {@code YourMessage}, as well as for the top-level
message.
@see FieldScope#ignoringFields(Iterable)
|
ignoringFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
Apache-2.0
|
public static FieldScope ignoringFieldDescriptors(
FieldDescriptor firstFieldDescriptor, FieldDescriptor... rest) {
return FieldScopeImpl.createIgnoringFieldDescriptors(asList(firstFieldDescriptor, rest));
}
|
Returns a {@link FieldScope} which matches everything except the provided field descriptors for
the message.
@see FieldScope#ignoringFieldDescriptors(FieldDescriptor, FieldDescriptor...)
|
ignoringFieldDescriptors
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
Apache-2.0
|
public static FieldScope ignoringFieldDescriptors(Iterable<FieldDescriptor> fieldDescriptors) {
return FieldScopeImpl.createIgnoringFieldDescriptors(fieldDescriptors);
}
|
Returns a {@link FieldScope} which matches everything except the provided field descriptors for
the message.
@see FieldScope#ignoringFieldDescriptors(Iterable)
|
ignoringFieldDescriptors
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
Apache-2.0
|
public static FieldScope allowingFields(int firstFieldNumber, int... rest) {
return FieldScopeImpl.createAllowingFields(asList(firstFieldNumber, rest));
}
|
Returns a {@link FieldScope} which matches nothing except the provided field numbers for the
top level message type.
@see FieldScope#allowingFields(int, int...)
|
allowingFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
Apache-2.0
|
public static FieldScope allowingFields(Iterable<Integer> fieldNumbers) {
return FieldScopeImpl.createAllowingFields(fieldNumbers);
}
|
Returns a {@link FieldScope} which matches nothing except the provided field numbers for the
top level message type.
@see FieldScope#allowingFields(Iterable)
|
allowingFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
Apache-2.0
|
public static FieldScope allowingFieldDescriptors(
FieldDescriptor firstFieldDescriptor, FieldDescriptor... rest) {
return FieldScopeImpl.createAllowingFieldDescriptors(asList(firstFieldDescriptor, rest));
}
|
Returns a {@link FieldScope} which matches nothing except the provided field descriptors for
the message.
@see FieldScope#allowingFieldDescriptors(FieldDescriptor, FieldDescriptor...)
|
allowingFieldDescriptors
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
Apache-2.0
|
public static FieldScope allowingFieldDescriptors(Iterable<FieldDescriptor> fieldDescriptors) {
return FieldScopeImpl.createAllowingFieldDescriptors(fieldDescriptors);
}
|
Returns a {@link FieldScope} which matches nothing except the provided field descriptors for
the message.
@see FieldScope#allowingFieldDescriptors(Iterable)
|
allowingFieldDescriptors
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
Apache-2.0
|
public static FieldScope all() {
return FieldScopeImpl.all();
}
|
Returns a {@link FieldScope} which matches all fields without exception. Generally not needed,
since the other factory functions will build on top of this for you.
|
all
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
Apache-2.0
|
public static FieldScope none() {
return FieldScopeImpl.none();
}
|
Returns a {@link FieldScope} which matches no fields. A comparison made using this scope alone
will always trivially pass. Generally not needed, since the other factory functions will build
on top of this for you.
|
none
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopes.java
|
Apache-2.0
|
static Function<Optional<Descriptor>, String> fieldNumbersFunction(
String fmt, Iterable<Integer> fieldNumbers) {
return optDescriptor -> resolveFieldNumbers(optDescriptor, fmt, fieldNumbers);
}
|
Returns a function which translates integer field numbers into field names using the Descriptor
if available.
@param fmt Format string that must contain exactly one '%s' and no other format parameters.
|
fieldNumbersFunction
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java
|
Apache-2.0
|
static Function<Optional<Descriptor>, String> fieldScopeFunction(
String fmt, FieldScope fieldScope) {
return optDescriptor -> String.format(fmt, fieldScope.usingCorrespondenceString(optDescriptor));
}
|
Returns a function which formats the given string by getting the usingCorrespondenceString from
the given FieldScope with the argument descriptor.
@param fmt Format string that must contain exactly one '%s' and no other format parameters.
|
fieldScopeFunction
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java
|
Apache-2.0
|
static Function<Optional<Descriptor>, String> concat(
Function<? super Optional<Descriptor>, String> function1,
Function<? super Optional<Descriptor>, String> function2) {
return optDescriptor -> function1.apply(optDescriptor) + function2.apply(optDescriptor);
}
|
Returns a function which concatenates the outputs of the two input functions.
|
concat
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java
|
Apache-2.0
|
static Optional<Descriptor> getSingleDescriptor(Iterable<? extends Message> messages) {
Optional<Descriptor> optDescriptor = Optional.absent();
for (Message message : messages) {
if (message != null) {
Descriptor descriptor = message.getDescriptorForType();
if (!optDescriptor.isPresent()) {
optDescriptor = Optional.of(descriptor);
} else if (descriptor != optDescriptor.get()) {
// Two different descriptors - abandon ship.
return Optional.absent();
}
}
}
return optDescriptor;
}
|
Returns the singular descriptor used by all non-null messages in the list.
<p>If there is no descriptor, or more than one, returns {@code Optional.absent()}.
|
getSingleDescriptor
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java
|
Apache-2.0
|
static List<Integer> asList(int first, int... rest) {
List<Integer> list = new ArrayList<>();
list.add(first);
list.addAll(Ints.asList(rest));
return list;
}
|
Joins the arguments into a {@link List} for convenience.
|
asList
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java
|
Apache-2.0
|
static String join(Iterable<?> objects) {
return JOINER.join(objects);
}
|
Joins the arguments into a {@link List} for convenience.
|
join
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java
|
Apache-2.0
|
private static String resolveFieldNumbers(
Optional<Descriptor> optDescriptor, String fmt, Iterable<Integer> fieldNumbers) {
if (optDescriptor.isPresent()) {
Descriptor descriptor = optDescriptor.get();
List<String> strings = new ArrayList<>();
for (int fieldNumber : fieldNumbers) {
FieldDescriptor field = descriptor.findFieldByNumber(fieldNumber);
strings.add(field != null ? field.toString() : String.format("%d (?)", fieldNumber));
}
return String.format(fmt, join(strings));
} else {
return String.format(fmt, join(fieldNumbers));
}
}
|
Formats {@code fmt} with the field numbers, concatenated, if a descriptor is available to
resolve them to field names. Otherwise it uses the raw integers.
@param fmt Format string that must contain exactly one '%s' and no other format parameters.
|
resolveFieldNumbers
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java
|
Apache-2.0
|
static FluentEqualityConfig defaultInstance() {
return DEFAULT_INSTANCE;
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
defaultInstance
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
@Override
public ProtoTruthMessageDifferencer load(Descriptor descriptor) {
return ProtoTruthMessageDifferencer.create(FluentEqualityConfig.this, descriptor);
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
load
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final String usingCorrespondenceString(Optional<Descriptor> descriptor) {
return usingCorrespondenceStringFunction().apply(descriptor);
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
usingCorrespondenceString
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig ignoringFieldAbsence() {
return toBuilder()
.setIgnoreFieldAbsenceScope(FieldScopeLogic.all())
.addUsingCorrespondenceString(".ignoringFieldAbsence()")
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
ignoringFieldAbsence
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig ignoringFieldAbsenceOfFields(Iterable<Integer> fieldNumbers) {
return toBuilder()
.setIgnoreFieldAbsenceScope(
ignoreFieldAbsenceScope().allowingFieldsNonRecursive(fieldNumbers))
.addUsingCorrespondenceFieldNumbersString(".ignoringFieldAbsenceOf(%s)", fieldNumbers)
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
ignoringFieldAbsenceOfFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig ignoringFieldAbsenceOfFieldDescriptors(
Iterable<FieldDescriptor> fieldDescriptors) {
return toBuilder()
.setIgnoreFieldAbsenceScope(
ignoreFieldAbsenceScope().allowingFieldDescriptorsNonRecursive(fieldDescriptors))
.addUsingCorrespondenceFieldDescriptorsString(
".ignoringFieldAbsenceOf(%s)", fieldDescriptors)
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
ignoringFieldAbsenceOfFieldDescriptors
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig ignoringRepeatedFieldOrder() {
return toBuilder()
.setIgnoreRepeatedFieldOrderScope(FieldScopeLogic.all())
.addUsingCorrespondenceString(".ignoringRepeatedFieldOrder()")
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
ignoringRepeatedFieldOrder
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig ignoringRepeatedFieldOrderOfFields(Iterable<Integer> fieldNumbers) {
return toBuilder()
.setIgnoreRepeatedFieldOrderScope(
ignoreRepeatedFieldOrderScope().allowingFieldsNonRecursive(fieldNumbers))
.addUsingCorrespondenceFieldNumbersString(".ignoringRepeatedFieldOrderOf(%s)", fieldNumbers)
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
ignoringRepeatedFieldOrderOfFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig ignoringRepeatedFieldOrderOfFieldDescriptors(
Iterable<FieldDescriptor> fieldDescriptors) {
return toBuilder()
.setIgnoreRepeatedFieldOrderScope(
ignoreRepeatedFieldOrderScope().allowingFieldDescriptorsNonRecursive(fieldDescriptors))
.addUsingCorrespondenceFieldDescriptorsString(
".ignoringRepeatedFieldOrderOf(%s)", fieldDescriptors)
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
ignoringRepeatedFieldOrderOfFieldDescriptors
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig ignoringExtraRepeatedFieldElements() {
return toBuilder()
.setIgnoreExtraRepeatedFieldElementsScope(FieldScopeLogic.all())
.addUsingCorrespondenceString(".ignoringExtraRepeatedFieldElements()")
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
ignoringExtraRepeatedFieldElements
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig ignoringExtraRepeatedFieldElementsOfFields(
Iterable<Integer> fieldNumbers) {
return toBuilder()
.setIgnoreExtraRepeatedFieldElementsScope(
ignoreExtraRepeatedFieldElementsScope().allowingFieldsNonRecursive(fieldNumbers))
.addUsingCorrespondenceFieldNumbersString(
".ignoringExtraRepeatedFieldElements(%s)", fieldNumbers)
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
ignoringExtraRepeatedFieldElementsOfFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig ignoringExtraRepeatedFieldElementsOfFieldDescriptors(
Iterable<FieldDescriptor> fieldDescriptors) {
return toBuilder()
.setIgnoreExtraRepeatedFieldElementsScope(
ignoreExtraRepeatedFieldElementsScope()
.allowingFieldDescriptorsNonRecursive(fieldDescriptors))
.addUsingCorrespondenceFieldDescriptorsString(
".ignoringExtraRepeatedFieldElements(%s)", fieldDescriptors)
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
ignoringExtraRepeatedFieldElementsOfFieldDescriptors
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig usingDoubleTolerance(double tolerance) {
return toBuilder()
.setDoubleCorrespondenceMap(
FieldScopeLogicMap.defaultValue(Correspondence.tolerance(tolerance)))
.addUsingCorrespondenceString(".usingDoubleTolerance(" + tolerance + ")")
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
usingDoubleTolerance
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig usingDoubleToleranceForFields(
double tolerance, Iterable<Integer> fieldNumbers) {
return toBuilder()
.setDoubleCorrespondenceMap(
doubleCorrespondenceMap()
.with(
FieldScopeLogic.none().allowingFieldsNonRecursive(fieldNumbers),
Correspondence.tolerance(tolerance)))
.addUsingCorrespondenceFieldNumbersString(
".usingDoubleTolerance(" + tolerance + ", %s)", fieldNumbers)
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
usingDoubleToleranceForFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig usingDoubleToleranceForFieldDescriptors(
double tolerance, Iterable<FieldDescriptor> fieldDescriptors) {
return toBuilder()
.setDoubleCorrespondenceMap(
doubleCorrespondenceMap()
.with(
FieldScopeLogic.none().allowingFieldDescriptorsNonRecursive(fieldDescriptors),
Correspondence.tolerance(tolerance)))
.addUsingCorrespondenceFieldDescriptorsString(
".usingDoubleTolerance(" + tolerance + ", %s)", fieldDescriptors)
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
usingDoubleToleranceForFieldDescriptors
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig usingFloatTolerance(float tolerance) {
return toBuilder()
.setFloatCorrespondenceMap(
FieldScopeLogicMap.defaultValue(Correspondence.tolerance(tolerance)))
.addUsingCorrespondenceString(".usingFloatTolerance(" + tolerance + ")")
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
usingFloatTolerance
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig usingFloatToleranceForFields(
float tolerance, Iterable<Integer> fieldNumbers) {
return toBuilder()
.setFloatCorrespondenceMap(
floatCorrespondenceMap()
.with(
FieldScopeLogic.none().allowingFieldsNonRecursive(fieldNumbers),
Correspondence.tolerance(tolerance)))
.addUsingCorrespondenceFieldNumbersString(
".usingFloatTolerance(" + tolerance + ", %s)", fieldNumbers)
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
usingFloatToleranceForFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig usingFloatToleranceForFieldDescriptors(
float tolerance, Iterable<FieldDescriptor> fieldDescriptors) {
return toBuilder()
.setFloatCorrespondenceMap(
floatCorrespondenceMap()
.with(
FieldScopeLogic.none().allowingFieldDescriptorsNonRecursive(fieldDescriptors),
Correspondence.tolerance(tolerance)))
.addUsingCorrespondenceFieldDescriptorsString(
".usingFloatTolerance(" + tolerance + ", %s)", fieldDescriptors)
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
usingFloatToleranceForFieldDescriptors
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig comparingExpectedFieldsOnly() {
return toBuilder()
.setCompareExpectedFieldsOnly(true)
.addUsingCorrespondenceString(".comparingExpectedFieldsOnly()")
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
comparingExpectedFieldsOnly
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig withExpectedMessages(Iterable<? extends Message> messages) {
Builder builder = toBuilder().setHasExpectedMessages(true);
if (compareExpectedFieldsOnly()) {
builder.setCompareFieldsScope(
FieldScopeLogic.and(
compareFieldsScope(),
FieldScopeImpl.createFromSetFields(
messages, useTypeRegistry(), useExtensionRegistry())
.logic()));
}
return builder.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
withExpectedMessages
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig withPartialScope(FieldScope partialScope) {
return toBuilder()
.setCompareFieldsScope(FieldScopeLogic.and(compareFieldsScope(), partialScope.logic()))
.addUsingCorrespondenceFieldScopeString(".withPartialScope(%s)", partialScope)
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
withPartialScope
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig ignoringFields(Iterable<Integer> fieldNumbers) {
return toBuilder()
.setCompareFieldsScope(compareFieldsScope().ignoringFields(fieldNumbers))
.addUsingCorrespondenceFieldNumbersString(".ignoringFields(%s)", fieldNumbers)
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
ignoringFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig ignoringFieldDescriptors(Iterable<FieldDescriptor> fieldDescriptors) {
return toBuilder()
.setCompareFieldsScope(compareFieldsScope().ignoringFieldDescriptors(fieldDescriptors))
.addUsingCorrespondenceFieldDescriptorsString(
".ignoringFieldDescriptors(%s)", fieldDescriptors)
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
ignoringFieldDescriptors
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig ignoringFieldScope(FieldScope fieldScope) {
return toBuilder()
.setCompareFieldsScope(
FieldScopeLogic.and(compareFieldsScope(), FieldScopeLogic.not(fieldScope.logic())))
.addUsingCorrespondenceFieldScopeString(".ignoringFieldScope(%s)", fieldScope)
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
ignoringFieldScope
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig reportingMismatchesOnly() {
return toBuilder()
.setReportMismatchesOnly(true)
.addUsingCorrespondenceString(".reportingMismatchesOnly()")
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
reportingMismatchesOnly
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final FluentEqualityConfig unpackingAnyUsing(
TypeRegistry typeRegistry, ExtensionRegistry extensionRegistry) {
return toBuilder()
.setUnpackingAnyUsing(typeRegistry, extensionRegistry)
.addUsingCorrespondenceString(
".unpackingAnyUsing(" + typeRegistry + ", " + extensionRegistry + ")")
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
unpackingAnyUsing
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
@Override
public final FluentEqualityConfig subScope(Descriptor rootDescriptor, SubScopeId subScopeId) {
return toBuilder()
.setIgnoreFieldAbsenceScope(ignoreFieldAbsenceScope().subScope(rootDescriptor, subScopeId))
.setIgnoreRepeatedFieldOrderScope(
ignoreRepeatedFieldOrderScope().subScope(rootDescriptor, subScopeId))
.setIgnoreExtraRepeatedFieldElementsScope(
ignoreExtraRepeatedFieldElementsScope().subScope(rootDescriptor, subScopeId))
.setDoubleCorrespondenceMap(doubleCorrespondenceMap().subScope(rootDescriptor, subScopeId))
.setFloatCorrespondenceMap(floatCorrespondenceMap().subScope(rootDescriptor, subScopeId))
.setCompareFieldsScope(compareFieldsScope().subScope(rootDescriptor, subScopeId))
.build();
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
subScope
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
@Override
public final void validate(
Descriptor rootDescriptor, FieldDescriptorValidator fieldDescriptorValidator) {
// FluentEqualityConfig should never be validated other than as a root entity.
Verify.verify(fieldDescriptorValidator == FieldDescriptorValidator.ALLOW_ALL);
ignoreFieldAbsenceScope()
.validate(rootDescriptor, FieldDescriptorValidator.IS_FIELD_WITH_ABSENCE);
ignoreRepeatedFieldOrderScope()
.validate(rootDescriptor, FieldDescriptorValidator.IS_FIELD_WITH_ORDER);
ignoreExtraRepeatedFieldElementsScope()
.validate(rootDescriptor, FieldDescriptorValidator.IS_FIELD_WITH_EXTRA_ELEMENTS);
doubleCorrespondenceMap().validate(rootDescriptor, FieldDescriptorValidator.IS_DOUBLE_FIELD);
floatCorrespondenceMap().validate(rootDescriptor, FieldDescriptorValidator.IS_FLOAT_FIELD);
compareFieldsScope().validate(rootDescriptor, FieldDescriptorValidator.ALLOW_ALL);
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
validate
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final ProtoTruthMessageDifferencer toMessageDifferencer(Descriptor descriptor) {
checkState(hasExpectedMessages(), "withExpectedMessages() not called");
return messageDifferencers.getUnchecked(descriptor);
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
toMessageDifferencer
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
final <M extends Message> Correspondence<M, M> toCorrespondence(
Optional<Descriptor> optDescriptor) {
checkState(hasExpectedMessages(), "withExpectedMessages() not called");
return Correspondence.from(
(@Nullable M actual, @Nullable M expected) ->
assertThat(actual).usingConfig(FluentEqualityConfig.this).testIsEqualTo(expected),
"is equivalent according to assertThat(proto)"
+ usingCorrespondenceString(optDescriptor)
+ ".isEqualTo(target) to")
.formattingDiffsUsing(this::formatDiff);
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
toCorrespondence
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
private <M extends Message> String formatDiff(@Nullable M actual, @Nullable M expected) {
if (actual == null || expected == null) {
return "";
}
return toMessageDifferencer(actual.getDescriptorForType())
.diffMessages(actual, expected)
.printToString(reportMismatchesOnly());
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
formatDiff
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
@CanIgnoreReturnValue
final Builder setUnpackingAnyUsing(
TypeRegistry typeRegistry, ExtensionRegistry extensionRegistry) {
setUseTypeRegistry(typeRegistry);
setUseExtensionRegistry(extensionRegistry);
return this;
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
setUnpackingAnyUsing
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
@CanIgnoreReturnValue
final Builder addUsingCorrespondenceString(String string) {
return setUsingCorrespondenceStringFunction(
FieldScopeUtil.concat(usingCorrespondenceStringFunction(), Functions.constant(string)));
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
addUsingCorrespondenceString
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
@CanIgnoreReturnValue
final Builder addUsingCorrespondenceFieldNumbersString(
String fmt, Iterable<Integer> fieldNumbers) {
return setUsingCorrespondenceStringFunction(
FieldScopeUtil.concat(
usingCorrespondenceStringFunction(),
FieldScopeUtil.fieldNumbersFunction(fmt, fieldNumbers)));
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
addUsingCorrespondenceFieldNumbersString
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
@CanIgnoreReturnValue
final Builder addUsingCorrespondenceFieldDescriptorsString(
String fmt, Iterable<FieldDescriptor> fieldDescriptors) {
return setUsingCorrespondenceStringFunction(
FieldScopeUtil.concat(
usingCorrespondenceStringFunction(),
Functions.constant(String.format(fmt, join(fieldDescriptors)))));
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
addUsingCorrespondenceFieldDescriptorsString
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
@CanIgnoreReturnValue
final Builder addUsingCorrespondenceFieldScopeString(String fmt, FieldScope fieldScope) {
return setUsingCorrespondenceStringFunction(
FieldScopeUtil.concat(
usingCorrespondenceStringFunction(),
FieldScopeUtil.fieldScopeFunction(fmt, fieldScope)));
}
|
A specification for a {@link ProtoTruthMessageDifferencer} for comparing two individual
protobufs.
<p>Can be used to compare lists, maps, and multimaps of protos as well by conversion to a {@link
Correspondence}.
|
addUsingCorrespondenceFieldScopeString
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FluentEqualityConfig.java
|
Apache-2.0
|
@Override
protected String actualCustomStringRepresentation() {
if (actual == null) {
return "null";
}
StringBuilder sb = new StringBuilder().append('[');
boolean first = true;
for (M element : actual) {
if (!first) {
sb.append(", ");
}
first = false;
try {
protoPrinter.print(element, sb);
} catch (IOException impossible) {
throw new AssertionError(impossible);
}
}
return sb.append(']').toString();
}
|
Truth subject for the iterables of protocol buffers.
<p>{@code ProtoTruth.assertThat(actual).containsExactly(expected)} performs the same assertion as
{@code Truth.assertThat(actual).containsExactly(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. {@code
ProtoTruth.assertThat(actual).ignoringRepeatedFieldOrder().containsExactlyEntriesIn(expected)}.
<p>By default, floating-point fields are compared using exact equality, which is <a
href="https://truth.dev/floating_point">probably not what you want</a> if the values are the
results of some arithmetic. To check for approximate equality, use {@link #usingDoubleTolerance},
{@link #usingFloatTolerance}, and {@linkplain #usingDoubleToleranceForFields(double, int, int...)
their per-field equivalents}.
<p>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.
@param <M> the type of the messages in the {@code Iterable}
|
actualCustomStringRepresentation
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosUsingCorrespondence<M> displayingDiffsPairedBy(
Function<? super M, ?> keyFunction) {
return usingCorrespondence().displayingDiffsPairedBy(keyFunction);
}
|
Specifies a way to pair up unexpected and missing elements in the message when an assertion
fails. For example:
<pre>{@code
assertThat(actualFoos)
.ignoringRepeatedFieldOrder()
.ignoringFields(Foo.BAR_FIELD_NUMBER)
.displayingDiffsPairedBy(Foo::getId)
.containsExactlyElementsIn(expectedFoos);
}</pre>
<p>On assertions where it makes sense to do so, the elements are paired as follows: they are
keyed by {@code keyFunction}, and if an unexpected element and a missing element have the same
non-null key then the they are paired up. (Elements with null keys are not paired.) The failure
message will show paired elements together, and a diff will be shown.
<p>The expected elements given in the assertion should be uniquely keyed by {@code
keyFunction}. If multiple missing elements have the same key then the pairing will be skipped.
<p>Useful key functions will have the property that key equality is less strict than the
already specified equality rules; i.e. given {@code actual} and {@code expected} values with
keys {@code actualKey} and {@code expectedKey}, if {@code actual} and {@code expected} compare
equal given the rest of the directives such as {@code ignoringRepeatedFieldOrder} and {@code
ignoringFields}, then it is guaranteed that {@code actualKey} is equal to {@code expectedKey},
but there are cases where {@code actualKey} is equal to {@code expectedKey} but the direct
comparison fails.
<p>Note that calling this method makes no difference to whether a test passes or fails, it just
improves the message if it fails.
|
displayingDiffsPairedBy
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
IterableOfProtosFluentAssertion<M> usingConfig(FluentEqualityConfig newConfig) {
return new IterableOfProtosFluentAssertionImpl<>(
new IterableOfProtosSubject<>(metadata, newConfig, actual));
}
|
Specifies a way to pair up unexpected and missing elements in the message when an assertion
fails. For example:
<pre>{@code
assertThat(actualFoos)
.ignoringRepeatedFieldOrder()
.ignoringFields(Foo.BAR_FIELD_NUMBER)
.displayingDiffsPairedBy(Foo::getId)
.containsExactlyElementsIn(expectedFoos);
}</pre>
<p>On assertions where it makes sense to do so, the elements are paired as follows: they are
keyed by {@code keyFunction}, and if an unexpected element and a missing element have the same
non-null key then the they are paired up. (Elements with null keys are not paired.) The failure
message will show paired elements together, and a diff will be shown.
<p>The expected elements given in the assertion should be uniquely keyed by {@code
keyFunction}. If multiple missing elements have the same key then the pairing will be skipped.
<p>Useful key functions will have the property that key equality is less strict than the
already specified equality rules; i.e. given {@code actual} and {@code expected} values with
keys {@code actualKey} and {@code expectedKey}, if {@code actual} and {@code expected} compare
equal given the rest of the directives such as {@code ignoringRepeatedFieldOrder} and {@code
ignoringFields}, then it is guaranteed that {@code actualKey} is equal to {@code expectedKey},
but there are cases where {@code actualKey} is equal to {@code expectedKey} but the direct
comparison fails.
<p>Note that calling this method makes no difference to whether a test passes or fails, it just
improves the message if it fails.
|
usingConfig
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> ignoringFieldAbsenceOfFields(
int firstFieldNumber, int... rest) {
return usingConfig(config.ignoringFieldAbsenceOfFields(asList(firstFieldNumber, 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 (via {@link
FieldDescriptor}) if they are to be ignored as well.
<p>Use {@link #ignoringFieldAbsence()} instead to ignore the 'has' bit for all fields.
@see #ignoringFieldAbsence() for details
|
ignoringFieldAbsenceOfFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> ignoringFieldAbsenceOfFields(
Iterable<Integer> fieldNumbers) {
return usingConfig(config.ignoringFieldAbsenceOfFields(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 (via {@link
FieldDescriptor}) if they are to be ignored as well.
<p>Use {@link #ignoringFieldAbsence()} instead to ignore the 'has' bit for all fields.
@see #ignoringFieldAbsence() for details
|
ignoringFieldAbsenceOfFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> ignoringFieldAbsenceOfFieldDescriptors(
FieldDescriptor firstFieldDescriptor, FieldDescriptor... rest) {
return usingConfig(
config.ignoringFieldAbsenceOfFieldDescriptors(asList(firstFieldDescriptor, 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.
<p>Use {@link #ignoringFieldAbsence()} instead to ignore the 'has' bit for all fields.
@see #ignoringFieldAbsence() for details
|
ignoringFieldAbsenceOfFieldDescriptors
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> ignoringFieldAbsenceOfFieldDescriptors(
Iterable<FieldDescriptor> fieldDescriptors) {
return usingConfig(config.ignoringFieldAbsenceOfFieldDescriptors(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.
<p>Use {@link #ignoringFieldAbsence()} instead to ignore the 'has' bit for all fields.
@see #ignoringFieldAbsence() for details
|
ignoringFieldAbsenceOfFieldDescriptors
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> ignoringRepeatedFieldOrder() {
return usingConfig(config.ignoringRepeatedFieldOrder());
}
|
Specifies that the ordering of repeated fields, at all levels, should be ignored when comparing
for equality.
<p>This setting applies to all repeated fields recursively, but it does not ignore structure.
For example, with {@link #ignoringRepeatedFieldOrder()}, a repeated {@code int32} field {@code
bar}, set inside a repeated message field {@code foo}, the following protos will all compare
equal:
<pre>{@code
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
}
}
}</pre>
<p>However, the following message will compare equal to none of these:
<pre>{@code
message4: {
foo: {
bar: 1
bar: 3
}
foo: {
bar: 2
bar: 4
}
}
}</pre>
<p>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.
|
ignoringRepeatedFieldOrder
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> ignoringRepeatedFieldOrderOfFields(
int firstFieldNumber, int... rest) {
return usingConfig(config.ignoringRepeatedFieldOrderOfFields(asList(firstFieldNumber, 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
(via {@link FieldDescriptor}) if their orders are to be ignored as well.
<p>Use {@link #ignoringRepeatedFieldOrder()} instead to ignore order for all fields.
@see #ignoringRepeatedFieldOrder() for details.
|
ignoringRepeatedFieldOrderOfFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> ignoringRepeatedFieldOrderOfFields(
Iterable<Integer> fieldNumbers) {
return usingConfig(config.ignoringRepeatedFieldOrderOfFields(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
(via {@link FieldDescriptor}) if their orders are to be ignored as well.
<p>Use {@link #ignoringRepeatedFieldOrder()} instead to ignore order for all fields.
@see #ignoringRepeatedFieldOrder() for details.
|
ignoringRepeatedFieldOrderOfFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> ignoringRepeatedFieldOrderOfFieldDescriptors(
FieldDescriptor firstFieldDescriptor, FieldDescriptor... rest) {
return usingConfig(
config.ignoringRepeatedFieldOrderOfFieldDescriptors(asList(firstFieldDescriptor, 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.
<p>Use {@link #ignoringRepeatedFieldOrder()} instead to ignore order for all fields.
@see #ignoringRepeatedFieldOrder() for details.
|
ignoringRepeatedFieldOrderOfFieldDescriptors
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> ignoringRepeatedFieldOrderOfFieldDescriptors(
Iterable<FieldDescriptor> fieldDescriptors) {
return usingConfig(config.ignoringRepeatedFieldOrderOfFieldDescriptors(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.
<p>Use {@link #ignoringRepeatedFieldOrder()} instead to ignore order for all fields.
@see #ignoringRepeatedFieldOrder() for details.
|
ignoringRepeatedFieldOrderOfFieldDescriptors
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> ignoringExtraRepeatedFieldElements() {
return usingConfig(config.ignoringExtraRepeatedFieldElements());
}
|
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, use {@link
#comparingExpectedFieldsOnly}.
<p>This rule is applied independently from {@link #ignoringRepeatedFieldOrder}. 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.)
|
ignoringExtraRepeatedFieldElements
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> ignoringExtraRepeatedFieldElementsOfFields(
int firstFieldNumber, int... rest) {
return usingConfig(
config.ignoringExtraRepeatedFieldElementsOfFields(asList(firstFieldNumber, rest)));
}
|
Specifies that extra repeated field elements for these explicitly specified top-level field
numbers should be ignored. Sub-fields must be specified explicitly (via {@link
FieldDescriptor}) if their extra elements are to be ignored as well.
<p>Use {@link #ignoringExtraRepeatedFieldElements()} instead to ignore these for all fields.
@see #ignoringExtraRepeatedFieldElements() for details.
|
ignoringExtraRepeatedFieldElementsOfFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> ignoringExtraRepeatedFieldElementsOfFields(
Iterable<Integer> fieldNumbers) {
return usingConfig(config.ignoringExtraRepeatedFieldElementsOfFields(fieldNumbers));
}
|
Specifies that extra repeated field elements for these explicitly specified top-level field
numbers should be ignored. Sub-fields must be specified explicitly (via {@link
FieldDescriptor}) if their extra elements are to be ignored as well.
<p>Use {@link #ignoringExtraRepeatedFieldElements()} instead to ignore these for all fields.
@see #ignoringExtraRepeatedFieldElements() for details.
|
ignoringExtraRepeatedFieldElementsOfFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> ignoringExtraRepeatedFieldElementsOfFieldDescriptors(
FieldDescriptor firstFieldDescriptor, FieldDescriptor... rest) {
return usingConfig(
config.ignoringExtraRepeatedFieldElementsOfFieldDescriptors(
asList(firstFieldDescriptor, 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.
<p>Use {@link #ignoringExtraRepeatedFieldElements()} instead to ignore these for all fields.
@see #ignoringExtraRepeatedFieldElements() for details.
|
ignoringExtraRepeatedFieldElementsOfFieldDescriptors
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> ignoringExtraRepeatedFieldElementsOfFieldDescriptors(
Iterable<FieldDescriptor> fieldDescriptors) {
return usingConfig(
config.ignoringExtraRepeatedFieldElementsOfFieldDescriptors(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.
<p>Use {@link #ignoringExtraRepeatedFieldElements()} instead to ignore these for all fields.
@see #ignoringExtraRepeatedFieldElements() for details.
|
ignoringExtraRepeatedFieldElementsOfFieldDescriptors
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> usingDoubleTolerance(double tolerance) {
return usingConfig(config.usingDoubleTolerance(tolerance));
}
|
Compares double fields as equal if they are both finite and their absolute difference is less
than or equal to {@code tolerance}.
@param tolerance A finite, non-negative tolerance.
|
usingDoubleTolerance
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> usingDoubleToleranceForFields(
double tolerance, int firstFieldNumber, int... rest) {
return usingConfig(
config.usingDoubleToleranceForFields(tolerance, asList(firstFieldNumber, rest)));
}
|
Compares double fields with these explicitly specified top-level field numbers using the
provided absolute tolerance.
@param tolerance A finite, non-negative tolerance.
|
usingDoubleToleranceForFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> usingDoubleToleranceForFields(
double tolerance, Iterable<Integer> fieldNumbers) {
return usingConfig(config.usingDoubleToleranceForFields(tolerance, fieldNumbers));
}
|
Compares double fields with these explicitly specified top-level field numbers using the
provided absolute tolerance.
@param tolerance A finite, non-negative tolerance.
|
usingDoubleToleranceForFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> usingDoubleToleranceForFieldDescriptors(
double tolerance, FieldDescriptor firstFieldDescriptor, FieldDescriptor... rest) {
return usingConfig(
config.usingDoubleToleranceForFieldDescriptors(
tolerance, asList(firstFieldDescriptor, rest)));
}
|
Compares double fields with these explicitly specified fields using the provided absolute
tolerance.
@param tolerance A finite, non-negative tolerance.
|
usingDoubleToleranceForFieldDescriptors
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> usingDoubleToleranceForFieldDescriptors(
double tolerance, Iterable<FieldDescriptor> fieldDescriptors) {
return usingConfig(config.usingDoubleToleranceForFieldDescriptors(tolerance, fieldDescriptors));
}
|
Compares double fields with these explicitly specified fields using the provided absolute
tolerance.
@param tolerance A finite, non-negative tolerance.
|
usingDoubleToleranceForFieldDescriptors
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> usingFloatTolerance(float tolerance) {
return usingConfig(config.usingFloatTolerance(tolerance));
}
|
Compares float fields as equal if they are both finite and their absolute difference is less
than or equal to {@code tolerance}.
@param tolerance A finite, non-negative tolerance.
|
usingFloatTolerance
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> usingFloatToleranceForFields(
float tolerance, int firstFieldNumber, int... rest) {
return usingConfig(
config.usingFloatToleranceForFields(tolerance, asList(firstFieldNumber, rest)));
}
|
Compares float fields with these explicitly specified top-level field numbers using the
provided absolute tolerance.
@param tolerance A finite, non-negative tolerance.
|
usingFloatToleranceForFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> usingFloatToleranceForFields(
float tolerance, Iterable<Integer> fieldNumbers) {
return usingConfig(config.usingFloatToleranceForFields(tolerance, fieldNumbers));
}
|
Compares float fields with these explicitly specified top-level field numbers using the
provided absolute tolerance.
@param tolerance A finite, non-negative tolerance.
|
usingFloatToleranceForFields
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
public IterableOfProtosFluentAssertion<M> usingFloatToleranceForFieldDescriptors(
float tolerance, FieldDescriptor firstFieldDescriptor, FieldDescriptor... rest) {
return usingConfig(
config.usingFloatToleranceForFieldDescriptors(
tolerance, asList(firstFieldDescriptor, rest)));
}
|
Compares float fields with these explicitly specified fields using the provided absolute
tolerance.
@param tolerance A finite, non-negative tolerance.
|
usingFloatToleranceForFieldDescriptors
|
java
|
google/truth
|
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
https://github.com/google/truth/blob/master/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
|
Apache-2.0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.