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 |
|---|---|---|---|---|---|---|---|
public final PrimitiveIntArraySubject that(int @Nullable [] actual) {
return about(intArrays()).that(actual);
} | Returns a new instance that invokes the given {@code FailureStrategy} when a check fails. Most
users should not need this. If you think you do, see the documentation on {@link
FailureStrategy}. | that | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final PrimitiveLongArraySubject that(long @Nullable [] actual) {
return about(longArrays()).that(actual);
} | Returns a new instance that invokes the given {@code FailureStrategy} when a check fails. Most
users should not need this. If you think you do, see the documentation on {@link
FailureStrategy}. | that | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final PrimitiveCharArraySubject that(char @Nullable [] actual) {
return about(charArrays()).that(actual);
} | Returns a new instance that invokes the given {@code FailureStrategy} when a check fails. Most
users should not need this. If you think you do, see the documentation on {@link
FailureStrategy}. | that | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final PrimitiveByteArraySubject that(byte @Nullable [] actual) {
return about(byteArrays()).that(actual);
} | Returns a new instance that invokes the given {@code FailureStrategy} when a check fails. Most
users should not need this. If you think you do, see the documentation on {@link
FailureStrategy}. | that | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final PrimitiveFloatArraySubject that(float @Nullable [] actual) {
return about(floatArrays()).that(actual);
} | Returns a new instance that invokes the given {@code FailureStrategy} when a check fails. Most
users should not need this. If you think you do, see the documentation on {@link
FailureStrategy}. | that | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final PrimitiveDoubleArraySubject that(double @Nullable [] actual) {
return about(doubleArrays()).that(actual);
} | Returns a new instance that invokes the given {@code FailureStrategy} when a check fails. Most
users should not need this. If you think you do, see the documentation on {@link
FailureStrategy}. | that | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final GuavaOptionalSubject that(com.google.common.base.@Nullable Optional<?> actual) {
return about(guavaOptionals()).that(actual);
} | Returns a new instance that invokes the given {@code FailureStrategy} when a check fails. Most
users should not need this. If you think you do, see the documentation on {@link
FailureStrategy}. | that | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final MapSubject that(@Nullable Map<?, ?> actual) {
return about(maps()).that(actual);
} | Returns a new instance that invokes the given {@code FailureStrategy} when a check fails. Most
users should not need this. If you think you do, see the documentation on {@link
FailureStrategy}. | that | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final MultimapSubject that(@Nullable Multimap<?, ?> actual) {
return about(multimaps()).that(actual);
} | Returns a new instance that invokes the given {@code FailureStrategy} when a check fails. Most
users should not need this. If you think you do, see the documentation on {@link
FailureStrategy}. | that | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final MultisetSubject that(@Nullable Multiset<?> actual) {
return about(multisets()).that(actual);
} | Returns a new instance that invokes the given {@code FailureStrategy} when a check fails. Most
users should not need this. If you think you do, see the documentation on {@link
FailureStrategy}. | that | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final TableSubject that(@Nullable Table<?, ?, ?> actual) {
return about(tables()).that(actual);
} | Returns a new instance that invokes the given {@code FailureStrategy} when a check fails. Most
users should not need this. If you think you do, see the documentation on {@link
FailureStrategy}. | that | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
@SuppressWarnings("NullableOptional") // Truth always accepts nulls, no matter the type
public final OptionalSubject that(@Nullable Optional<?> actual) {
return about(optionals()).that(actual);
} | @since 1.3.0 (with access to {@link OptionalSubject} previously part of {@code
truth-java8-extension}) | that | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final OptionalIntSubject that(@Nullable OptionalInt actual) {
return about(optionalInts()).that(actual);
} | @since 1.4.0 (with access to {@link OptionalIntSubject} previously part of {@code
truth-java8-extension}) | that | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final OptionalLongSubject that(@Nullable OptionalLong actual) {
return about(optionalLongs()).that(actual);
} | @since 1.4.0 (with access to {@link OptionalLongSubject} previously part of {@code
truth-java8-extension}) | that | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final OptionalDoubleSubject that(@Nullable OptionalDouble actual) {
return about(optionalDoubles()).that(actual);
} | @since 1.4.0 (with access to {@link OptionalDoubleSubject} previously part of {@code
truth-java8-extension}) | that | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final StreamSubject that(@Nullable Stream<?> actual) {
return about(streams()).that(actual);
} | @since 1.3.0 (with access to {@link StreamSubject} previously part of {@code
truth-java8-extension}) | that | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final IntStreamSubject that(@Nullable IntStream actual) {
return about(intStreams()).that(actual);
} | @since 1.4.0 (with access to {@link IntStreamSubject} previously part of {@code
truth-java8-extension}) | that | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final LongStreamSubject that(@Nullable LongStream actual) {
return about(longStreams()).that(actual);
} | @since 1.4.0 (with access to {@link LongStreamSubject} previously part of {@code
truth-java8-extension}) | that | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
@GwtIncompatible
@J2ObjCIncompatible
@J2ktIncompatible
public final PathSubject that(@Nullable Path actual) {
return about(paths()).that(actual);
} | @since 1.4.0 (with access to {@link PathSubject} previously part of {@code
truth-java8-extension}) | that | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final StandardSubjectBuilder withMessage(@Nullable String messageToPrepend) {
return withMessage("%s", messageToPrepend);
} | Returns a new instance that will output the given message before the main failure message. If
this method is called multiple times, the messages will appear in the order that they were
specified. | withMessage | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final StandardSubjectBuilder withMessage(String format, @Nullable Object... args) {
return new StandardSubjectBuilder(metadata().withMessage(format, args));
} | Returns a new instance that will output the given message before the main failure message. If
this method is called multiple times, the messages will appear in the order that they were
specified.
<p><b>Note:</b> the arguments will be substituted into the format template using {@link
com.google.common.base.Strings#leni... | withMessage | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final <S extends Subject, A> SimpleSubjectBuilder<S, A> about(
Subject.Factory<S, A> factory) {
return new SimpleSubjectBuilder<>(metadata(), factory);
} | Given a factory for some {@code Subject} class, returns a builder whose {@code that(actual)}
method creates instances of that class. Created subjects use the previously set failure
strategy and any previously set failure message. | about | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
public final <CustomSubjectBuilderT extends CustomSubjectBuilder> CustomSubjectBuilderT about(
CustomSubjectBuilder.Factory<CustomSubjectBuilderT> factory) {
return factory.createSubjectBuilder(metadata());
} | Given a factory for some {@code Subject} class, returns a builder whose {@code that(actual)}
method creates instances of that class. Created subjects use the previously set failure
strategy and any previously set failure message. | about | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
private FailureMetadata metadata() {
checkStatePreconditions();
return metadataDoNotReferenceDirectly;
} | Reports a failure.
<p>To set a message, first call {@link #withMessage} (or, more commonly, use the shortcut
{@link Truth#assertWithMessage}). | metadata | java | google/truth | core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java | Apache-2.0 |
@Deprecated
@SuppressWarnings("InlineMeSuggester") // We want users to remove the surrounding call entirely.
public static Factory<StreamSubject, Stream<?>> streams() {
return StreamSubject::new;
} | Obsolete factory instance. This factory was previously necessary for assertions like {@code
assertWithMessage(...).about(streams()).that(stream)....}. Now, you can perform assertions like
that without the {@code about(...)} call.
@deprecated Instead of {@code about(streams()).that(...)}, use just {@code that(...)}.
... | streams | java | google/truth | core/src/main/java/com/google/common/truth/StreamSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StreamSubject.java | Apache-2.0 |
private static Factory<StreamSubject, Stream<?>> streams(
Supplier<@Nullable List<?>> listSupplier) {
return (metadata, actual) -> new StreamSubject(metadata, actual, listSupplier);
} | Factory instance for creating an instance for which we already have a {@code listSupplier} from
an existing instance. Naturally, the resulting factory should be used to create an instance
only for the stream corresponding to {@code listSupplier}. | streams | java | google/truth | core/src/main/java/com/google/common/truth/StreamSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StreamSubject.java | Apache-2.0 |
public void containsAnyOf(
@Nullable Object first, @Nullable Object second, @Nullable Object @Nullable ... rest) {
checkThatContentsList().containsAnyOf(first, second, rest);
} | Checks that the actual stream contains at least one of the given elements. | containsAnyOf | java | google/truth | core/src/main/java/com/google/common/truth/StreamSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StreamSubject.java | Apache-2.0 |
@CanIgnoreReturnValue
public Ordered containsAtLeast(
@Nullable Object first, @Nullable Object second, @Nullable Object @Nullable ... rest) {
return checkThatContentsList().containsAtLeast(first, second, rest);
} | Checks that the actual stream contains all of the given elements. If an element appears more
than once in the given elements, then it must appear at least that number of times in the
actual elements.
<p>To also test that the contents appear in the given order, make a call to {@code inOrder()}
on the object returned by... | containsAtLeast | java | google/truth | core/src/main/java/com/google/common/truth/StreamSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StreamSubject.java | Apache-2.0 |
@CanIgnoreReturnValue
public Ordered containsAtLeastElementsIn(@Nullable Iterable<?> expected) {
return checkThatContentsList().containsAtLeastElementsIn(expected);
} | Checks that the actual stream contains all of the given elements. If an element appears more
than once in the given elements, then it must appear at least that number of times in the
actual elements.
<p>To also test that the contents appear in the given order, make a call to {@code inOrder()}
on the object returned by... | containsAtLeastElementsIn | java | google/truth | core/src/main/java/com/google/common/truth/StreamSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StreamSubject.java | Apache-2.0 |
@CanIgnoreReturnValue
/*
* We need to call containsExactly, not containsExactlyElementsIn, to get the handling we want for
* containsExactly(null).
*/
@SuppressWarnings("ContainsExactlyVariadic")
public Ordered containsExactly(@Nullable Object @Nullable ... expected) {
return checkThatContentsList().... | Checks that the actual stream contains exactly the given elements.
<p>Multiplicity is respected. For example, an object duplicated exactly 3 times in the
parameters asserts that the object must likewise be duplicated exactly 3 times in the actual
stream.
<p>To also test that the contents appear in the given order, ma... | containsExactly | java | google/truth | core/src/main/java/com/google/common/truth/StreamSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StreamSubject.java | Apache-2.0 |
@CanIgnoreReturnValue
public Ordered containsExactlyElementsIn(@Nullable Iterable<?> expected) {
return checkThatContentsList().containsExactlyElementsIn(expected);
} | Checks that the actual stream contains exactly the given elements.
<p>Multiplicity is respected. For example, an object duplicated exactly 3 times in the
parameters asserts that the object must likewise be duplicated exactly 3 times in the actual
stream.
<p>To also test that the contents appear in the given order, ma... | containsExactlyElementsIn | java | google/truth | core/src/main/java/com/google/common/truth/StreamSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StreamSubject.java | Apache-2.0 |
public void containsNoneOf(
@Nullable Object first, @Nullable Object second, @Nullable Object @Nullable ... rest) {
checkThatContentsList().containsNoneOf(first, second, rest);
} | Checks that the actual stream does not contain any of the given elements. | containsNoneOf | java | google/truth | core/src/main/java/com/google/common/truth/StreamSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StreamSubject.java | Apache-2.0 |
@Override
@Deprecated
public void isEqualTo(@Nullable Object expected) {
/*
* We add a warning about stream equality. Doing so is a bit of a pain. (There might be a better
* way.)
*
* We do need to create a StreamSubject (rather than a plain Subject) in order to get our
* desired string... | @deprecated {@code streamA.isEqualTo(streamB)} always fails, except when passed the exact same
stream reference. If you really want to test object identity, you can eliminate this
deprecation warning by using {@link #isSameInstanceAs}. If you instead want to test the
contents of the stream, use {@link #cont... | isEqualTo | java | google/truth | core/src/main/java/com/google/common/truth/StreamSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StreamSubject.java | Apache-2.0 |
@Override
@Deprecated
public void isNotEqualTo(@Nullable Object unexpected) {
if (actual() == unexpected) {
/*
* We override the supermethod's message: That method would ask for both
* `String.valueOf(stream)` (for `unexpected`) and `actualCustomStringRepresentation()` (for
* `actual(... | @deprecated {@code streamA.isNotEqualTo(streamB)} always passes, except when passed the exact
same stream reference. If you really want to test object identity, you can eliminate this
deprecation warning by using {@link #isNotSameInstanceAs}. If you instead want to test the
contents of the stream, collect b... | isNotEqualTo | java | google/truth | core/src/main/java/com/google/common/truth/StreamSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StreamSubject.java | Apache-2.0 |
private IterableSubject checkThatContentsList() {
return substituteCheck().that(listSupplier.get());
} | Be careful with using this, as documented on {@link Subject#substituteCheck}. | checkThatContentsList | java | google/truth | core/src/main/java/com/google/common/truth/StreamSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StreamSubject.java | Apache-2.0 |
private static Supplier<@Nullable List<?>> listCollector(@Nullable Stream<?> actual) {
return () -> actual == null ? null : actual.collect(toCollection(ArrayList::new));
} | Be careful with using this, as documented on {@link Subject#substituteCheck}. | listCollector | java | google/truth | core/src/main/java/com/google/common/truth/StreamSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StreamSubject.java | Apache-2.0 |
@Override
@Deprecated
public final void isEquivalentAccordingToCompareTo(@Nullable String other) {
super.isEquivalentAccordingToCompareTo(other);
} | @deprecated Use {@link #isEqualTo} instead. String comparison is consistent with equality. | isEquivalentAccordingToCompareTo | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
public void hasLength(int expectedLength) {
checkArgument(expectedLength >= 0, "expectedLength(%s) must be >= 0", expectedLength);
if (actual == null) {
failWithActual(fact("expected a string with length", expectedLength));
return;
}
check("length()").that(actual.length()).isEqualTo(expected... | Checks that the actual value has the given length. | hasLength | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
public void isEmpty() {
if (actual == null) {
failWithActual(simpleFact("expected an empty string"));
} else if (!actual.isEmpty()) {
failWithActual(simpleFact("expected to be empty"));
}
} | Checks that the actual value is the empty string. | isEmpty | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
public void isNotEmpty() {
if (actual == null) {
failWithActual(simpleFact("expected a non-empty string"));
} else if (actual.isEmpty()) {
failWithoutActual(simpleFact("expected not to be empty"));
}
} | Checks that the actual value is not the empty string. | isNotEmpty | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
public void contains(@Nullable CharSequence string) {
checkNotNull(string);
if (actual == null) {
failWithActual("expected a string that contains", string);
} else if (!actual.contains(string)) {
failWithActual("expected to contain", string);
}
} | Checks that the actual value contains the given sequence. | contains | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
public void doesNotContain(@Nullable CharSequence string) {
checkNotNull(string);
if (actual == null) {
failWithActual("expected a string that does not contain", string);
} else if (actual.contains(string)) {
failWithActual("expected not to contain", string);
}
} | Checks that the actual value does not contain the given sequence. | doesNotContain | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
public void startsWith(@Nullable String string) {
checkNotNull(string);
if (actual == null) {
failWithActual("expected a string that starts with", string);
} else if (!actual.startsWith(string)) {
failWithActual("expected to start with", string);
}
} | Checks that the actual value starts with the given string. | startsWith | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
public void endsWith(@Nullable String string) {
checkNotNull(string);
if (actual == null) {
failWithActual("expected a string that ends with", string);
} else if (!actual.endsWith(string)) {
failWithActual("expected to end with", string);
}
} | Checks that the actual value ends with the given string. | endsWith | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
public void matches(@Nullable String regex) {
checkNotNull(regex);
if (actual == null) {
failWithActual("expected a string that matches", regex);
} else if (!actual.matches(regex)) {
if (regex.equals(actual)) {
failWithoutActual(
fact("expected to match", regex),
... | Checks that the actual value matches the given regex. | matches | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
@GwtIncompatible("java.util.regex.Pattern")
public void matches(@Nullable Pattern regex) {
checkNotNull(regex);
if (actual == null) {
failWithActual("expected a string that matches", regex);
} else if (!regex.matcher(actual).matches()) {
if (regex.toString().equals(actual)) {
failWitho... | Checks that the actual value matches the given regex. | matches | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
public void doesNotMatch(@Nullable String regex) {
checkNotNull(regex);
if (actual == null) {
failWithActual("expected a string that does not match", regex);
} else if (actual.matches(regex)) {
failWithActual("expected not to match", regex);
}
} | Checks that the actual value does not match the given regex. | doesNotMatch | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
@GwtIncompatible("java.util.regex.Pattern")
public void doesNotMatch(@Nullable Pattern regex) {
checkNotNull(regex);
if (actual == null) {
failWithActual("expected a string that does not match", regex);
} else if (regex.matcher(actual).matches()) {
failWithActual("expected not to match", regex... | Checks that the actual value does not match the given regex. | doesNotMatch | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
@GwtIncompatible("java.util.regex.Pattern")
public void containsMatch(@Nullable Pattern regex) {
checkNotNull(regex);
if (actual == null) {
failWithActual("expected a string that contains a match for", regex);
} else if (!regex.matcher(actual).find()) {
failWithActual("expected to contain a ma... | Checks that the actual value contains a match on the given regex. | containsMatch | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
public void containsMatch(@Nullable String regex) {
checkNotNull(regex);
if (actual == null) {
failWithActual("expected a string that contains a match for", regex);
} else if (!Platform.containsMatch(actual, regex)) {
failWithActual("expected to contain a match for", regex);
}
} | Checks that the actual value contains a match on the given regex. | containsMatch | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
@GwtIncompatible("java.util.regex.Pattern")
public void doesNotContainMatch(@Nullable Pattern regex) {
checkNotNull(regex);
if (actual == null) {
failWithActual("expected a string that does not contain a match for", regex);
return;
}
Matcher matcher = regex.matcher(actual);
if (matcher... | Checks that the actual value does not contain a match on the given regex. | doesNotContainMatch | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
public void doesNotContainMatch(@Nullable String regex) {
checkNotNull(regex);
if (actual == null) {
failWithActual("expected a string that does not contain a match for", regex);
} else if (Platform.containsMatch(actual, regex)) {
failWithActual("expected not to contain a match for", regex);
... | Checks that the actual value does not contain a match on the given regex. | doesNotContainMatch | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
public CaseInsensitiveStringComparison ignoringCase() {
return CaseInsensitiveStringComparison.create(this);
} | Returns a {@link StringSubject}-like instance that will ignore the case of the characters.
<p>Character equality ignoring case is defined as follows: Characters must be equal either
after calling {@link Character#toLowerCase} or after calling {@link Character#toUpperCase}.
Note that this is independent of any locale. | ignoringCase | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
public void isEqualTo(@Nullable String expected) {
if (actual == null) {
if (expected != null) {
failWithoutActual(
fact("expected a string that is equal to", expected),
butWas(),
simpleFact("(case is ignored)"));
}
} else {
if (exp... | Checks that the actual value is equal to the given sequence (while ignoring case). For the
purposes of this comparison, two strings are equal if either of the following is true:
<ul>
<li>They are equal according to {@link String#equalsIgnoreCase}. (In Kotlin terms: They are
equal according to <a
href="ht... | isEqualTo | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
public void isNotEqualTo(@Nullable String unexpected) {
if (actual == null) {
if (unexpected == null) {
failWithoutActual(
fact("expected a string that is not equal to", "null (null reference)"),
simpleFact("(case is ignored)"));
}
} else {
if (a... | Checks that the actual value is not equal to the given string (while ignoring case). The
meaning of equality is the same as for the {@link #isEqualTo} method. | isNotEqualTo | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
public void contains(@Nullable CharSequence expectedSequence) {
checkNotNull(expectedSequence);
String expected = expectedSequence.toString();
if (actual == null) {
failWithoutActual(
fact("expected a string that contains", expected),
butWas(),
simpleFact("(... | Checks that the actual value contains the given sequence (while ignoring case). | contains | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
public void doesNotContain(@Nullable CharSequence expectedSequence) {
checkNotNull(expectedSequence);
String expected = expectedSequence.toString();
if (actual == null) {
failWithoutActual(
fact("expected a string that does not contain", expected),
butWas(),
... | Checks that the actual value does not contain the given sequence (while ignoring case). | doesNotContain | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
private static boolean containsIgnoreCase(String actual, String string) {
for (int actualOffset = 0;
actualOffset <= actual.length() - string.length();
actualOffset++) {
if (actual.regionMatches(
/* ignoreCase= */ true,
/* toffset= */ actualOffset,
/... | Checks that the actual value does not contain the given sequence (while ignoring case). | containsIgnoreCase | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
private Fact butWas() {
return subject.butWas();
} | Checks that the actual value does not contain the given sequence (while ignoring case). | butWas | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
private void failWithoutActual(Fact first, Fact... rest) {
subject.failWithoutActual(first, rest);
} | Checks that the actual value does not contain the given sequence (while ignoring case). | failWithoutActual | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
static CaseInsensitiveStringComparison create(StringSubject stringSubject) {
return new CaseInsensitiveStringComparison(stringSubject);
} | Checks that the actual value does not contain the given sequence (while ignoring case). | create | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
static Factory<StringSubject, String> strings() {
return StringSubject::new;
} | Checks that the actual value does not contain the given sequence (while ignoring case). | strings | java | google/truth | core/src/main/java/com/google/common/truth/StringSubject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StringSubject.java | Apache-2.0 |
private void standardIsEqualTo(@Nullable Object expected) {
ComparisonResult difference = compareForEquality(expected);
if (!difference.valuesAreEqual()) {
failEqualityCheck(EqualityCheck.EQUAL, expected, difference);
}
} | Checks that the value under test is equal to the given object. For the purposes of this
comparison, two objects are equal if any of the following is true:
<ul>
<li>they are equal according to {@link Objects#equals}
<li>they are arrays and are considered equal by the appropriate {@link Arrays#equals}
overload... | standardIsEqualTo | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
private void standardIsNotEqualTo(@Nullable Object unexpected) {
ComparisonResult difference = compareForEquality(unexpected);
if (difference.valuesAreEqual()) {
String unexpectedAsString = formatActualOrExpected(unexpected);
if (actualCustomStringRepresentation().equals(unexpectedAsString)) {
... | Checks that the value under test is not equal to the given object. The meaning of equality is
the same as for the {@link #isEqualTo} method. | standardIsNotEqualTo | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
private ComparisonResult compareForEquality(@Nullable Object expected) {
if (actual == null && expected == null) {
return ComparisonResult.equal();
} else if (actual == null || expected == null) {
return ComparisonResult.differentNoDescription();
} else if (actual instanceof byte[] && expected i... | Returns whether {@code actual} equals {@code expected} differ and, in some cases, a description
of how they differ.
<p>The equality check follows the rules described on {@link #isEqualTo}. | compareForEquality | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
private static boolean isIntegralBoxedPrimitive(@Nullable Object o) {
return o instanceof Byte
|| o instanceof Short
|| o instanceof Character
|| o instanceof Integer
|| o instanceof Long;
} | Returns whether {@code actual} equals {@code expected} differ and, in some cases, a description
of how they differ.
<p>The equality check follows the rules described on {@link #isEqualTo}. | isIntegralBoxedPrimitive | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
private static long integralValue(Object o) {
if (o instanceof Character) {
return (long) ((Character) o).charValue();
} else if (o instanceof Number) {
return ((Number) o).longValue();
} else {
throw new AssertionError(o + " must be either a Character or a Number.");
}
} | Returns whether {@code actual} equals {@code expected} differ and, in some cases, a description
of how they differ.
<p>The equality check follows the rules described on {@link #isEqualTo}. | integralValue | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
public final void isSameInstanceAs(@Nullable Object expected) {
if (actual != expected) {
failEqualityCheck(
SAME_INSTANCE,
expected,
/*
* Pass through *whether* the values are equal so that failEqualityCheck() can print that
* information. But remove the de... | Checks that the value under test is the same instance as the given object.
<p>This method considers {@code null} to be "the same instance as" {@code null} and not the
same instance as anything else. | isSameInstanceAs | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
public final void isNotSameInstanceAs(@Nullable Object unexpected) {
if (actual == unexpected) {
/*
* We use actualCustomStringRepresentation() because it might be overridden to be better than
* actual.toString()/unexpected.toString().
*/
failWithoutActual(
fact("expected ... | Checks that the value under test is not the same instance as the given object.
<p>This method considers {@code null} to be "the same instance as" {@code null} and not the
same instance as anything else. | isNotSameInstanceAs | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
public void isInstanceOf(Class<?> clazz) {
if (clazz == null) {
throw new NullPointerException("clazz");
}
if (actual == null) {
failWithActual("expected instance of", clazz.getName());
return;
}
if (!isInstanceOfType(actual, clazz)) {
if (Platform.classMetadataUnsupported())... | Checks that the value under test is an instance of the given class. | isInstanceOf | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
public void isNotInstanceOf(Class<?> clazz) {
if (clazz == null) {
throw new NullPointerException("clazz");
}
if (Platform.classMetadataUnsupported()) {
throw new UnsupportedOperationException(
"isNotInstanceOf is not supported under -XdisableClassMetadata");
}
if (actual == nu... | Checks that the value under test is not an instance of the given class. | isNotInstanceOf | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
private static boolean isInstanceOfType(Object instance, Class<?> clazz) {
checkArgument(
!clazz.isPrimitive(),
"Cannot check instanceof for primitive type %s. Pass the wrapper class %s instead.",
clazz.getSimpleName(),
Primitives.wrap(clazz).getSimpleName());
return Platform.isI... | Checks that the value under test is not an instance of the given class. | isInstanceOfType | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
public void isIn(@Nullable Iterable<?> iterable) {
checkNotNull(iterable);
if (!contains(iterable, actual)) {
failWithActual("expected any of", iterable);
}
} | Checks that the value under test is equal to any element in the given iterable. | isIn | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
private static boolean contains(Iterable<?> haystack, @Nullable Object needle) {
if (isKotlinRange(haystack)) {
return kotlinRangeContains(haystack, needle);
}
return Iterables.contains(haystack, needle);
} | Checks that the value under test is equal to any element in the given iterable. | contains | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
public void isAnyOf(
@Nullable Object first, @Nullable Object second, @Nullable Object @Nullable ... rest) {
isIn(accumulate(first, second, rest));
} | Checks that the value under test is equal to any of the given elements. | isAnyOf | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
public void isNotIn(@Nullable Iterable<?> iterable) {
checkNotNull(iterable);
if (Iterables.contains(iterable, actual)) {
failWithActual("expected not to be any of", iterable);
}
} | Checks that the value under test is not equal to any element in the given iterable. | isNotIn | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
public void isNoneOf(
@Nullable Object first, @Nullable Object second, @Nullable Object @Nullable ... rest) {
isNotIn(accumulate(first, second, rest));
} | Checks that the value under test is not equal to any of the given elements. | isNoneOf | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
final @Nullable Object actual() {
return actual;
} | Returns the actual value under test. | actual | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
@ForOverride
protected String actualCustomStringRepresentation() {
return formatActualOrExpected(actual);
} | Supplies the direct string representation of the actual value to other methods which may prefix
or otherwise position it in an error message. This should only be overridden to provide an
improved string representation of the value under test, as it would appear in any given error
message, and should not be used for add... | actualCustomStringRepresentation | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
final String actualCustomStringRepresentationForPackageMembersToCall() {
return actualCustomStringRepresentation();
} | Supplies the direct string representation of the actual value to other methods which may prefix
or otherwise position it in an error message. This should only be overridden to provide an
improved string representation of the value under test, as it would appear in any given error
message, and should not be used for add... | actualCustomStringRepresentationForPackageMembersToCall | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
private static String formatActualOrExpected(@Nullable Object o) {
if (o instanceof byte[]) {
return base16((byte[]) o);
} else if (o != null && o.getClass().isArray()) {
return String.valueOf(arrayAsListRecursively(o));
} else if (o instanceof Double) {
return doubleToString((Double) o);
... | Supplies the direct string representation of the actual value to other methods which may prefix
or otherwise position it in an error message. This should only be overridden to provide an
improved string representation of the value under test, as it would appear in any given error
message, and should not be used for add... | formatActualOrExpected | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
private static String base16(byte[] bytes) {
StringBuilder sb = new StringBuilder(2 * bytes.length);
for (byte b : bytes) {
sb.append(hexDigitsUpper[(b >> 4) & 0xf]).append(hexDigitsUpper[b & 0xf]);
}
return sb.toString();
} | Supplies the direct string representation of the actual value to other methods which may prefix
or otherwise position it in an error message. This should only be overridden to provide an
improved string representation of the value under test, as it would appear in any given error
message, and should not be used for add... | base16 | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
private static @Nullable Object arrayAsListRecursively(@Nullable Object input) {
if (input instanceof Object[]) {
return Lists.<@Nullable Object, @Nullable Object>transform(
asList((@Nullable Object[]) input), Subject::arrayAsListRecursively);
} else if (input instanceof boolean[]) {
retur... | Supplies the direct string representation of the actual value to other methods which may prefix
or otherwise position it in an error message. This should only be overridden to provide an
improved string representation of the value under test, as it would appear in any given error
message, and should not be used for add... | arrayAsListRecursively | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
static ComparisonResult fromEqualsResult(boolean equal) {
return equal ? EQUAL : DIFFERENT_NO_DESCRIPTION;
} | If {@code equal} is true, returns an equal result; if false, a non-equal result with no
description. | fromEqualsResult | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
static ComparisonResult differentWithDescription(Fact... facts) {
return new ComparisonResult(ImmutableList.copyOf(facts));
} | Returns a non-equal result with the given description. | differentWithDescription | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
static ComparisonResult differentNoDescription() {
return DIFFERENT_NO_DESCRIPTION;
} | Returns a non-equal result with no description. | differentNoDescription | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
boolean valuesAreEqual() {
return facts == null;
} | Returns a non-equal result with no description. | valuesAreEqual | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
ImmutableList<Fact> factsOrEmpty() {
return firstNonNull(facts, ImmutableList.of());
} | Returns a non-equal result with no description. | factsOrEmpty | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
ComparisonResult withoutDescription() {
return fromEqualsResult(valuesAreEqual());
} | Returns an instance with the same "equal"/"not-equal" bit but with no description. | withoutDescription | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
private static ComparisonResult checkByteArrayEquals(byte[] expected, byte[] actual) {
if (Arrays.equals(expected, actual)) {
return ComparisonResult.equal();
}
return ComparisonResult.differentWithDescription(
fact("expected", Arrays.toString(expected)), fact("but was", Arrays.toString(actual... | Returns {@link ComparisonResult#equal} if the arrays are equal. If not equal, returns a string
comparing the two arrays, displaying them in the style "[1, 2, 3]" to supplement the main
failure message, which uses the style "010203." | checkByteArrayEquals | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
private static ComparisonResult checkArrayEqualsRecursive(
Object expectedArray, Object actualArray, String lastIndex) {
if (expectedArray == actualArray) {
return ComparisonResult.equal();
}
String expectedType = arrayType(expectedArray);
String actualType = arrayType(actualArray);
if (... | Returns {@link ComparisonResult#equal} if the arrays are equal, recursively. If not equal,
returns the string of the index at which they're different. | checkArrayEqualsRecursive | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
private static String arrayType(Object array) {
if (array.getClass() == boolean[].class) {
return "boolean[]";
} else if (array.getClass() == int[].class) {
return "int[]";
} else if (array.getClass() == long[].class) {
return "long[]";
} else if (array.getClass() == short[].class) {
... | Returns {@link ComparisonResult#equal} if the arrays are equal, recursively. If not equal,
returns the string of the index at which they're different. | arrayType | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
private static boolean gwtSafeObjectEquals(@Nullable Object actual, @Nullable Object expected) {
if (actual instanceof Double && expected instanceof Double) {
return Double.doubleToLongBits((Double) actual) == Double.doubleToLongBits((Double) expected);
} else if (actual instanceof Float && expected insta... | Returns {@link ComparisonResult#equal} if the arrays are equal, recursively. If not equal,
returns the string of the index at which they're different. | gwtSafeObjectEquals | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
private static List<String> doubleArrayAsString(double[] items) {
List<String> itemAsStrings = new ArrayList<>(items.length);
for (double item : items) {
itemAsStrings.add(doubleToString(item));
}
return itemAsStrings;
} | Returns {@link ComparisonResult#equal} if the arrays are equal, recursively. If not equal,
returns the string of the index at which they're different. | doubleArrayAsString | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
private static List<String> floatArrayAsString(float[] items) {
List<String> itemAsStrings = new ArrayList<>(items.length);
for (float item : items) {
itemAsStrings.add(floatToString(item));
}
return itemAsStrings;
} | Returns {@link ComparisonResult#equal} if the arrays are equal, recursively. If not equal,
returns the string of the index at which they're different. | floatArrayAsString | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
@Deprecated
final StandardSubjectBuilder check() {
return new StandardSubjectBuilder(metadata.updateForCheckCall());
} | Returns a builder for creating a derived subject but without providing information about how
the derived subject will relate to the current subject. In most cases, you should provide such
information by using {@linkplain #check(String, Object...) the other overload}.
@deprecated Use {@linkplain #check(String, Object..... | check | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
protected final StandardSubjectBuilder check(String format, @Nullable Object... args) {
return doCheck(OldAndNewValuesAreSimilar.DIFFERENT, format, args);
} | Returns a builder for creating a derived subject.
<p>Derived subjects retain the {@link FailureStrategy} and {@linkplain
StandardSubjectBuilder#withMessage messages} of the current subject, and in some cases, they
automatically supplement their failure message with information about the original subject.
<p>For examp... | check | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
final StandardSubjectBuilder checkNoNeedToDisplayBothValues(
String format, @Nullable Object... args) {
return doCheck(OldAndNewValuesAreSimilar.SIMILAR, format, args);
} | Returns a builder for creating a derived subject.
<p>Derived subjects retain the {@link FailureStrategy} and {@linkplain
StandardSubjectBuilder#withMessage messages} of the current subject, and in some cases, they
automatically supplement their failure message with information about the original subject.
<p>For examp... | checkNoNeedToDisplayBothValues | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
final StandardSubjectBuilder substituteCheck() {
return new StandardSubjectBuilder(checkNotNull(metadata));
} | Returns a builder for creating a subject for an object that is "close enough" to the original
actual value.
<p>This is a niche API: When one {@link Subject} wants to delegate to another, it should
normally use {@link #check(String, Object...)}, which augments the failure message by:
<ul>
<li>specifying which <i>par... | substituteCheck | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
private StandardSubjectBuilder doCheck(
OldAndNewValuesAreSimilar valuesAreSimilar, String format, @Nullable Object[] args) {
LazyMessage message = LazyMessage.create(format, args);
return new StandardSubjectBuilder(
metadata.updateForCheckCall(
valuesAreSimilar, /* descriptionUpdate= ... | Returns a builder for creating a subject for an object that is "close enough" to the original
actual value.
<p>This is a niche API: When one {@link Subject} wants to delegate to another, it should
normally use {@link #check(String, Object...)}, which augments the failure message by:
<ul>
<li>specifying which <i>par... | doCheck | java | google/truth | core/src/main/java/com/google/common/truth/Subject.java | https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Subject.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.