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
private static String countDuplicatesMultimap(Multimap<?, ?> multimap) { List<String> entries = new ArrayList<>(); for (Object key : multimap.keySet()) { entries.add(key + "=" + countDuplicates(get(multimap, key))); } StringBuilder sb = new StringBuilder(); sb.append("{"); Joiner.on(", ")...
Advances the iterator until it either returns value, or has no more elements. <p>Returns true if the value was found, false if the end was reached before finding it. <p>This is basically the same as {@link com.google.common.collect.Iterables#contains}, but where the contract explicitly states that the iterator isn't ...
countDuplicatesMultimap
java
google/truth
core/src/main/java/com/google/common/truth/MultimapSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/MultimapSubject.java
Apache-2.0
private static Multimap<?, ?> annotateEmptyStringsMultimap(Multimap<?, ?> multimap) { if (multimap.containsKey("") || multimap.containsValue("")) { ListMultimap<@Nullable Object, @Nullable Object> annotatedMultimap = LinkedListMultimap.create(); for (Map.Entry<?, ?> entry : multimap.entries())...
Returns a multimap with all empty strings (as keys or values) replaced by a non-empty human understandable indicator for an empty string. <p>Returns the given multimap if it contains no empty strings.
annotateEmptyStringsMultimap
java
google/truth
core/src/main/java/com/google/common/truth/MultimapSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/MultimapSubject.java
Apache-2.0
public <A extends @Nullable Object, E extends @Nullable Object> UsingCorrespondence<A, E> comparingValuesUsing( Correspondence<? super A, ? super E> correspondence) { return UsingCorrespondence.create(this, correspondence); }
Starts a method chain for a check in which the actual values (i.e. the values of the {@link Multimap} under test) are compared to expected values using the given {@link Correspondence}. The actual values must be of type {@code A}, and the expected values must be of type {@code E}. The check is actually executed by cont...
comparingValuesUsing
java
google/truth
core/src/main/java/com/google/common/truth/MultimapSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/MultimapSubject.java
Apache-2.0
@SuppressWarnings("nullness") // TODO: b/423853632 - Remove after checker is fixed. public void containsEntry(@Nullable Object expectedKey, E expectedValue) { if (checkNotNull(actual).containsKey(expectedKey)) { // Found matching key. Collection<A> actualValues = checkNotNull(getCastActual().a...
Checks that the actual multimap contains an entry with the given key and a value that corresponds to the given value.
containsEntry
java
google/truth
core/src/main/java/com/google/common/truth/MultimapSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/MultimapSubject.java
Apache-2.0
public void doesNotContainEntry(@Nullable Object excludedKey, E excludedValue) { if (checkNotNull(actual).containsKey(excludedKey)) { Collection<A> actualValues = checkNotNull(getCastActual().asMap().get(excludedKey)); List<A> matchingValues = new ArrayList<>(); Correspondence.ExceptionSto...
Checks that the actual multimap does not contain an entry with the given key and a value that corresponds to the given value.
doesNotContainEntry
java
google/truth
core/src/main/java/com/google/common/truth/MultimapSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/MultimapSubject.java
Apache-2.0
@CanIgnoreReturnValue public Ordered containsExactlyEntriesIn(Multimap<?, ? extends E> expectedMultimap) { return internalContainsExactlyEntriesIn(expectedMultimap); }
Checks that the actual multimap contains exactly the keys in the given multimap, mapping to values that correspond to the values of the given multimap. <p>A subsequent call to {@link Ordered#inOrder} may be made if the caller wishes to verify that the two Multimaps iterate fully in the same order. That is, their key s...
containsExactlyEntriesIn
java
google/truth
core/src/main/java/com/google/common/truth/MultimapSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/MultimapSubject.java
Apache-2.0
private <K extends @Nullable Object, V extends E> Ordered internalContainsExactlyEntriesIn( Multimap<K, V> expectedMultimap) { // Note: The non-fuzzy MultimapSubject.containsExactlyEntriesIn has a custom implementation // and produces somewhat better failure messages simply asserting about the itera...
Checks that the actual multimap contains exactly the keys in the given multimap, mapping to values that correspond to the values of the given multimap. <p>A subsequent call to {@link Ordered#inOrder} may be made if the caller wishes to verify that the two Multimaps iterate fully in the same order. That is, their key s...
internalContainsExactlyEntriesIn
java
google/truth
core/src/main/java/com/google/common/truth/MultimapSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/MultimapSubject.java
Apache-2.0
@CanIgnoreReturnValue public Ordered containsAtLeastEntriesIn(Multimap<?, ? extends E> expectedMultimap) { return internalContainsAtLeastEntriesIn(expectedMultimap); }
Checks that the actual multimap contains at least the keys in the given multimap, mapping to values that correspond to the values of the given multimap. <p>A subsequent call to {@link Ordered#inOrder} may be made if the caller wishes to verify that the two Multimaps iterate fully in the same order. That is, their key ...
containsAtLeastEntriesIn
java
google/truth
core/src/main/java/com/google/common/truth/MultimapSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/MultimapSubject.java
Apache-2.0
private <K extends @Nullable Object, V extends E> Ordered internalContainsAtLeastEntriesIn( Multimap<K, V> expectedMultimap) { // Note: The non-fuzzy MultimapSubject.containsAtLeastEntriesIn has a custom implementation // and produces somewhat better failure messages simply asserting about the itera...
Checks that the actual multimap contains at least the keys in the given multimap, mapping to values that correspond to the values of the given multimap. <p>A subsequent call to {@link Ordered#inOrder} may be made if the caller wishes to verify that the two Multimaps iterate fully in the same order. That is, their key ...
internalContainsAtLeastEntriesIn
java
google/truth
core/src/main/java/com/google/common/truth/MultimapSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/MultimapSubject.java
Apache-2.0
@CanIgnoreReturnValue public Ordered containsExactly(@Nullable Object k0, @Nullable E v0, @Nullable Object... rest) { @SuppressWarnings("unchecked") Multimap<?, E> expectedMultimap = (Multimap<?, E>) accumulateMultimap(k0, v0, rest); return containsExactlyEntriesIn(expectedMultimap); }
Checks that the actual multimap contains exactly the given set of key/value pairs. <p><b>Warning:</b> the use of varargs means that we cannot guarantee an equal number of key/value pairs at compile time. Please make sure you provide varargs in key/value pairs!
containsExactly
java
google/truth
core/src/main/java/com/google/common/truth/MultimapSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/MultimapSubject.java
Apache-2.0
@CanIgnoreReturnValue public Ordered containsExactly() { return subject.containsExactly(); }
Checks that the actual multimap is empty.
containsExactly
java
google/truth
core/src/main/java/com/google/common/truth/MultimapSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/MultimapSubject.java
Apache-2.0
@CanIgnoreReturnValue public Ordered containsAtLeast(@Nullable Object k0, @Nullable E v0, @Nullable Object... rest) { @SuppressWarnings("unchecked") Multimap<?, E> expectedMultimap = (Multimap<?, E>) accumulateMultimap(k0, v0, rest); return containsAtLeastEntriesIn(expectedMultimap); }
Checks that the actual multimap contains at least the given key/value pairs. <p><b>Warning:</b> the use of varargs means that we cannot guarantee an equal number of key/value pairs at compile time. Please make sure you provide varargs in key/value pairs!
containsAtLeast
java
google/truth
core/src/main/java/com/google/common/truth/MultimapSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/MultimapSubject.java
Apache-2.0
@SuppressWarnings("unchecked") // throwing ClassCastException is the correct behaviour private Multimap<?, A> getCastActual() { return (Multimap<?, A>) checkNotNull(actual); }
Checks that the actual multimap contains at least the given key/value pairs. <p><b>Warning:</b> the use of varargs means that we cannot guarantee an equal number of key/value pairs at compile time. Please make sure you provide varargs in key/value pairs!
getCastActual
java
google/truth
core/src/main/java/com/google/common/truth/MultimapSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/MultimapSubject.java
Apache-2.0
private String actualCustomStringRepresentationForPackageMembersToCall() { return subject.actualCustomStringRepresentationForPackageMembersToCall(); }
Checks that the actual multimap contains at least the given key/value pairs. <p><b>Warning:</b> the use of varargs means that we cannot guarantee an equal number of key/value pairs at compile time. Please make sure you provide varargs in key/value pairs!
actualCustomStringRepresentationForPackageMembersToCall
java
google/truth
core/src/main/java/com/google/common/truth/MultimapSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/MultimapSubject.java
Apache-2.0
static <E extends @Nullable Object, A extends @Nullable Object> UsingCorrespondence<A, E> create( MultimapSubject subject, Correspondence<? super A, ? super E> correspondence) { return new UsingCorrespondence<>(subject, correspondence); }
Checks that the actual multimap contains at least the given key/value pairs. <p><b>Warning:</b> the use of varargs means that we cannot guarantee an equal number of key/value pairs at compile time. Please make sure you provide varargs in key/value pairs!
create
java
google/truth
core/src/main/java/com/google/common/truth/MultimapSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/MultimapSubject.java
Apache-2.0
private static < K extends @Nullable Object, A extends @Nullable Object, E extends @Nullable Object> Correspondence<Map.Entry<K, A>, Map.Entry<K, E>> entryCorrespondence( Correspondence<? super A, ? super E> valueCorrespondence) { return Correspondence.from( (Map.Entry<K, A> actual...
Checks that the actual multimap contains at least the given key/value pairs. <p><b>Warning:</b> the use of varargs means that we cannot guarantee an equal number of key/value pairs at compile time. Please make sure you provide varargs in key/value pairs!
entryCorrespondence
java
google/truth
core/src/main/java/com/google/common/truth/MultimapSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/MultimapSubject.java
Apache-2.0
static Factory<MultimapSubject, Multimap<?, ?>> multimaps() { return MultimapSubject::new; }
Checks that the actual multimap contains at least the given key/value pairs. <p><b>Warning:</b> the use of varargs means that we cannot guarantee an equal number of key/value pairs at compile time. Please make sure you provide varargs in key/value pairs!
multimaps
java
google/truth
core/src/main/java/com/google/common/truth/MultimapSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/MultimapSubject.java
Apache-2.0
public final void hasCount(@Nullable Object element, int expectedCount) { checkArgument(expectedCount >= 0, "expectedCount(%s) must be >= 0", expectedCount); int actualCount = checkNotNull(actual).count(element); check("count(%s)", element).that(actualCount).isEqualTo(expectedCount); }
Checks that the actual multiset has exactly the given number of occurrences of the given element.
hasCount
java
google/truth
core/src/main/java/com/google/common/truth/MultisetSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/MultisetSubject.java
Apache-2.0
static Factory<MultisetSubject, Multiset<?>> multisets() { return MultisetSubject::new; }
Checks that the actual multiset has exactly the given number of occurrences of the given element.
multisets
java
google/truth
core/src/main/java/com/google/common/truth/MultisetSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/MultisetSubject.java
Apache-2.0
@SuppressWarnings("nullness") static <T extends @Nullable Object> T uncheckedCastNullableTToT(@Nullable T t) { return t; }
Accepts a {@code @Nullable T} and returns a plain {@code T}, without performing any check that that conversion is safe. <p>This method is intended to help with usages of type parameters that have parametric nullness. If a type parameter instead ranges over only non-null types (or if the type is a non-variable type, li...
uncheckedCastNullableTToT
java
google/truth
core/src/main/java/com/google/common/truth/NullnessCasts.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/NullnessCasts.java
Apache-2.0
public IterableSubject asList() { if (actual == null) { failWithoutActual(simpleFact("cannot perform assertions on the contents of a null array")); return ignoreCheck().that(ImmutableList.of()); } return checkNoNeedToDisplayBothValues("asList()").that(Arrays.asList(actual)); }
A subject for {@code Object[]} and more generically {@code T[]}. @author Christian Gruber
asList
java
google/truth
core/src/main/java/com/google/common/truth/ObjectArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/ObjectArraySubject.java
Apache-2.0
static <T extends @Nullable Object> Factory<ObjectArraySubject<T>, T[]> objectArrays() { return ObjectArraySubject::new; }
Checks that the actual array has the given length.
objectArrays
java
google/truth
core/src/main/java/com/google/common/truth/ObjectArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/ObjectArraySubject.java
Apache-2.0
public void isPresent() { if (actual == null) { failWithActual(simpleFact("expected present optional")); } else if (!actual.isPresent()) { failWithoutActual(simpleFact("expected to be present")); } }
Checks that the actual {@link OptionalDouble} contains a value.
isPresent
java
google/truth
core/src/main/java/com/google/common/truth/OptionalDoubleSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/OptionalDoubleSubject.java
Apache-2.0
public void isEmpty() { if (actual == null) { failWithActual(simpleFact("expected empty optional")); } else if (actual.isPresent()) { failWithoutActual( simpleFact("expected to be empty"), fact("but was present with value", doubleToString(actual.getAsDouble()))); } }
Checks that the actual {@link OptionalDouble} does not contain a value.
isEmpty
java
google/truth
core/src/main/java/com/google/common/truth/OptionalDoubleSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/OptionalDoubleSubject.java
Apache-2.0
@Deprecated @SuppressWarnings("InlineMeSuggester") // We want users to remove the surrounding call entirely. public static Factory<OptionalDoubleSubject, OptionalDouble> optionalDoubles() { return OptionalDoubleSubject::new; }
Obsolete factory instance. This factory was previously necessary for assertions like {@code assertWithMessage(...).about(optionalDoubles()).that(optional)....}. Now, you can perform assertions like that without the {@code about(...)} call. @deprecated Instead of {@code about(optionalDoubles()).that(...)}, use just {@c...
optionalDoubles
java
google/truth
core/src/main/java/com/google/common/truth/OptionalDoubleSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/OptionalDoubleSubject.java
Apache-2.0
public void isPresent() { if (actual == null) { failWithActual(simpleFact("expected present optional")); } else if (!actual.isPresent()) { failWithoutActual(simpleFact("expected to be present")); } }
Checks that the actual {@link OptionalInt} contains a value.
isPresent
java
google/truth
core/src/main/java/com/google/common/truth/OptionalIntSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/OptionalIntSubject.java
Apache-2.0
public void isEmpty() { if (actual == null) { failWithActual(simpleFact("expected empty optional")); } else if (actual.isPresent()) { failWithoutActual( simpleFact("expected to be empty"), fact("but was present with value", actual.getAsInt())); } }
Checks that the actual {@link OptionalInt} does not contain a value.
isEmpty
java
google/truth
core/src/main/java/com/google/common/truth/OptionalIntSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/OptionalIntSubject.java
Apache-2.0
@Deprecated @SuppressWarnings("InlineMeSuggester") // We want users to remove the surrounding call entirely. public static Factory<OptionalIntSubject, OptionalInt> optionalInts() { return OptionalIntSubject::new; }
Obsolete factory instance. This factory was previously necessary for assertions like {@code assertWithMessage(...).about(optionalInts()).that(optional)....}. Now, you can perform assertions like that without the {@code about(...)} call. @deprecated Instead of {@code about(optionalInts()).that(...)}, use just {@code th...
optionalInts
java
google/truth
core/src/main/java/com/google/common/truth/OptionalIntSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/OptionalIntSubject.java
Apache-2.0
public void isPresent() { if (actual == null) { failWithActual(simpleFact("expected present optional")); } else if (!actual.isPresent()) { failWithoutActual(simpleFact("expected to be present")); } }
Checks that the actual {@link OptionalLong} contains a value.
isPresent
java
google/truth
core/src/main/java/com/google/common/truth/OptionalLongSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/OptionalLongSubject.java
Apache-2.0
public void isEmpty() { if (actual == null) { failWithActual(simpleFact("expected empty optional")); } else if (actual.isPresent()) { failWithoutActual( simpleFact("expected to be empty"), fact("but was present with value", actual.getAsLong())); } }
Checks that the actual {@link OptionalLong} does not contain a value.
isEmpty
java
google/truth
core/src/main/java/com/google/common/truth/OptionalLongSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/OptionalLongSubject.java
Apache-2.0
@Deprecated @SuppressWarnings("InlineMeSuggester") // We want users to remove the surrounding call entirely. public static Factory<OptionalLongSubject, OptionalLong> optionalLongs() { return OptionalLongSubject::new; }
Obsolete factory instance. This factory was previously necessary for assertions like {@code assertWithMessage(...).about(optionalLongs()).that(optional)....}. Now, you can perform assertions like that without the {@code about(...)} call. @deprecated Instead of {@code about(optionalLongs()).that(...)}, use just {@code ...
optionalLongs
java
google/truth
core/src/main/java/com/google/common/truth/OptionalLongSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/OptionalLongSubject.java
Apache-2.0
public void isPresent() { if (actual == null) { failWithActual(simpleFact("expected present optional")); } else if (!actual.isPresent()) { failWithoutActual(simpleFact("expected to be present")); } }
Checks that the actual {@link Optional} contains a value.
isPresent
java
google/truth
core/src/main/java/com/google/common/truth/OptionalSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/OptionalSubject.java
Apache-2.0
public void isEmpty() { if (actual == null) { failWithActual(simpleFact("expected empty optional")); } else if (actual.isPresent()) { failWithoutActual( simpleFact("expected to be empty"), fact("but was present with value", actual.get())); } }
Checks that the actual {@link Optional} does not contain a value.
isEmpty
java
google/truth
core/src/main/java/com/google/common/truth/OptionalSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/OptionalSubject.java
Apache-2.0
public void hasValue(@Nullable Object expected) { if (expected == null) { failWithoutActual( simpleFact("expected an optional with a null value, but that is impossible"), fact("was", actual)); } else if (actual == null) { failWithActual("expected an optional with value", expected...
Checks that the actual {@link Optional} contains the given value. <p>To make more complex assertions on the optional's value, split your assertion in two: <pre>{@code assertThat(myOptional).isPresent(); assertThat(myOptional.get()).contains("foo"); }</pre>
hasValue
java
google/truth
core/src/main/java/com/google/common/truth/OptionalSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/OptionalSubject.java
Apache-2.0
@Deprecated @SuppressWarnings("InlineMeSuggester") // We want users to remove the surrounding call entirely. public static Factory<OptionalSubject, Optional<?>> optionals() { return OptionalSubject::new; }
Obsolete factory instance. This factory was previously necessary for assertions like {@code assertWithMessage(...).about(paths()).that(path)....}. Now, you can perform assertions like that without the {@code about(...)} call. @deprecated Instead of {@code about(optionals()).that(...)}, use just {@code that(...)}. ...
optionals
java
google/truth
core/src/main/java/com/google/common/truth/OptionalSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/OptionalSubject.java
Apache-2.0
@Deprecated @SuppressWarnings("InlineMeSuggester") // We want users to remove the surrounding call entirely. public static Factory<PathSubject, Path> paths() { return PathSubject::new; }
Obsolete factory instance. This factory was previously necessary for assertions like {@code assertWithMessage(...).about(paths()).that(path)....}. Now, you can perform assertions like that without the {@code about(...)} call. @deprecated Instead of {@code about(paths()).that(...)}, use just {@code that(...)}. Similarl...
paths
java
google/truth
core/src/main/java/com/google/common/truth/PathSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/PathSubject.java
Apache-2.0
static boolean isInstanceOfType(Object instance, Class<?> clazz) { return clazz.isInstance(instance); }
Returns true if the instance is assignable to the type Clazz.
isInstanceOfType
java
google/truth
core/src/main/java/com/google/common/truth/Platform.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Platform.java
Apache-2.0
static boolean containsMatch(String actual, String regex) { return Pattern.compile(regex).matcher(actual).find(); }
Determines if the given actual value contains a match for the given regex.
containsMatch
java
google/truth
core/src/main/java/com/google/common/truth/Platform.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Platform.java
Apache-2.0
static @Nullable String inferDescription() { if (isInferDescriptionDisabled()) { return null; } AssertionError stack = new AssertionError(); /* * cleanStackTrace() lets users turn off cleaning, so it's possible that we'll end up operating * on an uncleaned stack trace. That should be mo...
Tries to infer a name for the root actual value from the bytecode. The "root" actual value is the value passed to {@code assertThat} or {@code that}, as distinct from any later actual values produced by chaining calls like {@code hasMessageThat}.
inferDescription
java
google/truth
core/src/main/java/com/google/common/truth/Platform.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Platform.java
Apache-2.0
static @Nullable ImmutableList<Fact> makeDiff(String expected, String actual) { List<String> expectedLines = splitLines(expected); List<String> actualLines = splitLines(actual); List<String> unifiedDiff = generateUnifiedDiff(expectedLines, actualLines, /* contextSize= */ 3); if (unifiedDiff.isEm...
Tries to infer a name for the root actual value from the bytecode. The "root" actual value is the value passed to {@code assertThat} or {@code that}, as distinct from any later actual values produced by chaining calls like {@code hasMessageThat}.
makeDiff
java
google/truth
core/src/main/java/com/google/common/truth/Platform.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Platform.java
Apache-2.0
private static List<String> splitLines(String s) { return Splitter.on(NEWLINE_PATTERN).splitToList(s); }
Tries to infer a name for the root actual value from the bytecode. The "root" actual value is the value passed to {@code assertThat} or {@code that}, as distinct from any later actual values produced by chaining calls like {@code hasMessageThat}.
splitLines
java
google/truth
core/src/main/java/com/google/common/truth/Platform.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Platform.java
Apache-2.0
@Override public final String getMessage() { return message; }
Tries to infer a name for the root actual value from the bytecode. The "root" actual value is the value passed to {@code assertThat} or {@code that}, as distinct from any later actual values produced by chaining calls like {@code hasMessageThat}.
getMessage
java
google/truth
core/src/main/java/com/google/common/truth/Platform.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Platform.java
Apache-2.0
@Override public final String toString() { return checkNotNull(getLocalizedMessage()); }
Tries to infer a name for the root actual value from the bytecode. The "root" actual value is the value passed to {@code assertThat} or {@code that}, as distinct from any later actual values produced by chaining calls like {@code hasMessageThat}.
toString
java
google/truth
core/src/main/java/com/google/common/truth/Platform.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Platform.java
Apache-2.0
static String doubleToString(double value) { return Double.toString(value); }
Tries to infer a name for the root actual value from the bytecode. The "root" actual value is the value passed to {@code assertThat} or {@code that}, as distinct from any later actual values produced by chaining calls like {@code hasMessageThat}.
doubleToString
java
google/truth
core/src/main/java/com/google/common/truth/Platform.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Platform.java
Apache-2.0
static String floatToString(float value) { return Float.toString(value); }
Tries to infer a name for the root actual value from the bytecode. The "root" actual value is the value passed to {@code assertThat} or {@code that}, as distinct from any later actual values produced by chaining calls like {@code hasMessageThat}.
floatToString
java
google/truth
core/src/main/java/com/google/common/truth/Platform.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Platform.java
Apache-2.0
static String stringValueOfNonFloatingPoint(@Nullable Object o) { return String.valueOf(o); }
Turns a non-double, non-float object into a string.
stringValueOfNonFloatingPoint
java
google/truth
core/src/main/java/com/google/common/truth/Platform.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Platform.java
Apache-2.0
static String getStackTraceAsString(Throwable throwable) { return Throwables.getStackTraceAsString(throwable); }
Returns a human readable string representation of the throwable's stack trace.
getStackTraceAsString
java
google/truth
core/src/main/java/com/google/common/truth/Platform.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Platform.java
Apache-2.0
static boolean isAndroid() { return checkNotNull(System.getProperty("java.runtime.name", "")).contains("Android"); }
Tests if current platform is Android.
isAndroid
java
google/truth
core/src/main/java/com/google/common/truth/Platform.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Platform.java
Apache-2.0
private static boolean isInferDescriptionDisabled() { // Reading system properties might be forbidden. try { return Boolean.parseBoolean( System.getProperty("com.google.common.truth.disable_infer_description")); } catch (SecurityException e) { // Hope for the best. return false; ...
Wrapping interface of {@link TestRule} to be used within truth. <p>Note that the sole purpose of this interface is to allow it to be swapped in GWT implementation.
isInferDescriptionDisabled
java
google/truth
core/src/main/java/com/google/common/truth/Platform.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Platform.java
Apache-2.0
static AssertionError makeComparisonFailure( ImmutableList<String> messages, ImmutableList<Fact> facts, String expected, String actual, @Nullable Throwable cause) { Class<?> comparisonFailureClass; try { comparisonFailureClass = Class.forName("com.google.common.truth.Comparis...
Wrapping interface of {@link TestRule} to be used within truth. <p>Note that the sole purpose of this interface is to allow it to be swapped in GWT implementation.
makeComparisonFailure
java
google/truth
core/src/main/java/com/google/common/truth/Platform.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Platform.java
Apache-2.0
private static LinkageError newLinkageError(Throwable cause) { return new LinkageError(cause.toString(), cause); }
Wrapping interface of {@link TestRule} to be used within truth. <p>Note that the sole purpose of this interface is to allow it to be swapped in GWT implementation.
newLinkageError
java
google/truth
core/src/main/java/com/google/common/truth/Platform.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Platform.java
Apache-2.0
static boolean isKotlinRange(Iterable<?> iterable) { return closedRangeClassIfAvailable.get() != null && closedRangeClassIfAvailable.get().isInstance(iterable); // (If the class isn't available, then nothing could be an instance of ClosedRange.) }
Wrapping interface of {@link TestRule} to be used within truth. <p>Note that the sole purpose of this interface is to allow it to be swapped in GWT implementation.
isKotlinRange
java
google/truth
core/src/main/java/com/google/common/truth/Platform.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Platform.java
Apache-2.0
static boolean kotlinRangeContains(Iterable<?> haystack, @Nullable Object needle) { try { return (boolean) closedRangeContainsMethod.get().invoke(haystack, needle); } catch (InvocationTargetException e) { if (e.getCause() instanceof ClassCastException) { // icky but no worse than what we nor...
Wrapping interface of {@link TestRule} to be used within truth. <p>Note that the sole purpose of this interface is to allow it to be swapped in GWT implementation.
kotlinRangeContains
java
google/truth
core/src/main/java/com/google/common/truth/Platform.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Platform.java
Apache-2.0
static boolean classMetadataUnsupported() { // https://github.com/google/truth/issues/198 // TODO(cpovirk): Consider whether to remove instanceof tests under GWT entirely. // TODO(cpovirk): Run more Truth tests under GWT, and add tests for this. return false; }
Wrapping interface of {@link TestRule} to be used within truth. <p>Note that the sole purpose of this interface is to allow it to be swapped in GWT implementation.
classMetadataUnsupported
java
google/truth
core/src/main/java/com/google/common/truth/Platform.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Platform.java
Apache-2.0
public IterableSubject asList() { if (actual == null) { failWithoutActual(simpleFact("cannot perform assertions on the contents of a null array")); return ignoreCheck().that(ImmutableList.of()); } return checkNoNeedToDisplayBothValues("asList()").that(Booleans.asList(actual)); }
A subject for {@code boolean[]}. @author Christian Gruber (cgruber@israfil.net)
asList
java
google/truth
core/src/main/java/com/google/common/truth/PrimitiveBooleanArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/PrimitiveBooleanArraySubject.java
Apache-2.0
static Factory<PrimitiveBooleanArraySubject, boolean[]> booleanArrays() { return PrimitiveBooleanArraySubject::new; }
Checks that the actual array has the given length.
booleanArrays
java
google/truth
core/src/main/java/com/google/common/truth/PrimitiveBooleanArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/PrimitiveBooleanArraySubject.java
Apache-2.0
public IterableSubject asList() { if (actual == null) { failWithoutActual(simpleFact("cannot perform assertions on the contents of a null array")); return ignoreCheck().that(emptyList()); } return checkNoNeedToDisplayBothValues("asList()").that(Bytes.asList(actual)); }
A subject for {@code byte[]}. @author Kurt Alfred Kluever
asList
java
google/truth
core/src/main/java/com/google/common/truth/PrimitiveByteArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/PrimitiveByteArraySubject.java
Apache-2.0
static Factory<PrimitiveByteArraySubject, byte[]> byteArrays() { return PrimitiveByteArraySubject::new; }
Checks that the actual array has the given length.
byteArrays
java
google/truth
core/src/main/java/com/google/common/truth/PrimitiveByteArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/PrimitiveByteArraySubject.java
Apache-2.0
public IterableSubject asList() { if (actual == null) { failWithoutActual(simpleFact("cannot perform assertions on the contents of a null array")); return ignoreCheck().that(emptyList()); } return checkNoNeedToDisplayBothValues("asList()").that(Chars.asList(actual)); }
A subject for {@code char[]}. @author Christian Gruber (cgruber@israfil.net)
asList
java
google/truth
core/src/main/java/com/google/common/truth/PrimitiveCharArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/PrimitiveCharArraySubject.java
Apache-2.0
static Factory<PrimitiveCharArraySubject, char[]> charArrays() { return PrimitiveCharArraySubject::new; }
Checks that the actual array has the given length.
charArrays
java
google/truth
core/src/main/java/com/google/common/truth/PrimitiveCharArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/PrimitiveCharArraySubject.java
Apache-2.0
public DoubleArrayAsIterable usingTolerance(double tolerance) { if (actual == null) { failWithoutActual(simpleFact("cannot perform assertions on the contents of a null array")); return ignoreCheck().that(new double[0]).usingTolerance(tolerance); } return DoubleArrayAsIterable.create(tolerance(to...
Starts a method chain for a check in which the actual values (i.e. the elements of the array under test) are compared to expected elements using a {@link Correspondence} which considers values to correspond if they are finite values within {@code tolerance} of each other. The check is actually executed by continuing th...
usingTolerance
java
google/truth
core/src/main/java/com/google/common/truth/PrimitiveDoubleArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/PrimitiveDoubleArraySubject.java
Apache-2.0
private static double checkedToDouble(Number expected) { checkNotNull(expected); checkArgument( expected instanceof Double || expected instanceof Float || expected instanceof Integer || expected instanceof Long, "Expected value in assertion using exact double ...
Starts a method chain for a check in which the actual values (i.e. the elements of the array under test) are compared to expected elements using a {@link Correspondence} which considers values to correspond if they are finite values within {@code tolerance} of each other. The check is actually executed by continuing th...
checkedToDouble
java
google/truth
core/src/main/java/com/google/common/truth/PrimitiveDoubleArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/PrimitiveDoubleArraySubject.java
Apache-2.0
public DoubleArrayAsIterable usingExactEquality() { if (actual == null) { failWithoutActual(simpleFact("cannot perform assertions on the contents of a null array")); return ignoreCheck().that(new double[0]).usingExactEquality(); } return DoubleArrayAsIterable.create(EXACT_EQUALITY_CORRESPONDENCE...
Starts a method chain for a check in which the actual values (i.e. the elements of the array under test) are compared to expected elements using a {@link Correspondence} which considers values to correspond if they are exactly equal, with equality defined by {@link Double#equals}. This method is <i>not</i> recommended ...
usingExactEquality
java
google/truth
core/src/main/java/com/google/common/truth/PrimitiveDoubleArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/PrimitiveDoubleArraySubject.java
Apache-2.0
public FloatArrayAsIterable usingTolerance(double tolerance) { if (actual == null) { failWithoutActual(simpleFact("cannot perform assertions on the contents of a null array")); return ignoreCheck().that(new float[0]).usingTolerance(tolerance); } return FloatArrayAsIterable.create(tolerance(toler...
Starts a method chain for a check in which the actual values (i.e. the elements of the array under test) are compared to expected elements using a {@link Correspondence} which considers values to correspond if they are finite values within {@code tolerance} of each other. The check is actually executed by continuing th...
usingTolerance
java
google/truth
core/src/main/java/com/google/common/truth/PrimitiveFloatArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/PrimitiveFloatArraySubject.java
Apache-2.0
private static float checkedToFloat(Number expected) { checkNotNull(expected); checkArgument( !(expected instanceof Double), "Expected value in assertion using exact float equality was a double, which is not " + "supported as a double may not have an exact float representation"); ...
Starts a method chain for a check in which the actual values (i.e. the elements of the array under test) are compared to expected elements using a {@link Correspondence} which considers values to correspond if they are finite values within {@code tolerance} of each other. The check is actually executed by continuing th...
checkedToFloat
java
google/truth
core/src/main/java/com/google/common/truth/PrimitiveFloatArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/PrimitiveFloatArraySubject.java
Apache-2.0
public FloatArrayAsIterable usingExactEquality() { if (actual == null) { failWithoutActual(simpleFact("cannot perform assertions on the contents of a null array")); return ignoreCheck().that(new float[0]).usingExactEquality(); } return FloatArrayAsIterable.create(EXACT_EQUALITY_CORRESPONDENCE, i...
Starts a method chain for a check in which the actual values (i.e. the elements of the array under test) are compared to expected elements using a {@link Correspondence} which considers values to correspond if they are exactly equal, with equality defined by {@link Float#equals}. This method is <i>not</i> recommended w...
usingExactEquality
java
google/truth
core/src/main/java/com/google/common/truth/PrimitiveFloatArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/PrimitiveFloatArraySubject.java
Apache-2.0
public IterableSubject asList() { if (actual == null) { failWithoutActual(simpleFact("cannot perform assertions on the contents of a null array")); return ignoreCheck().that(emptyList()); } return checkNoNeedToDisplayBothValues("asList()").that(Ints.asList(actual)); }
A subject for {@code int[]}. @author Christian Gruber (cgruber@israfil.net)
asList
java
google/truth
core/src/main/java/com/google/common/truth/PrimitiveIntArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/PrimitiveIntArraySubject.java
Apache-2.0
static Factory<PrimitiveIntArraySubject, int[]> intArrays() { return PrimitiveIntArraySubject::new; }
Checks that the actual array has the given length.
intArrays
java
google/truth
core/src/main/java/com/google/common/truth/PrimitiveIntArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/PrimitiveIntArraySubject.java
Apache-2.0
public IterableSubject asList() { if (actual == null) { failWithoutActual(simpleFact("cannot perform assertions on the contents of a null array")); return ignoreCheck().that(emptyList()); } return checkNoNeedToDisplayBothValues("asList()").that(Longs.asList(actual)); }
A subject for {@code long[]}. @author Christian Gruber (cgruber@israfil.net)
asList
java
google/truth
core/src/main/java/com/google/common/truth/PrimitiveLongArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/PrimitiveLongArraySubject.java
Apache-2.0
static Factory<PrimitiveLongArraySubject, long[]> longArrays() { return PrimitiveLongArraySubject::new; }
Checks that the actual array has the given length.
longArrays
java
google/truth
core/src/main/java/com/google/common/truth/PrimitiveLongArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/PrimitiveLongArraySubject.java
Apache-2.0
public IterableSubject asList() { if (actual == null) { failWithoutActual(simpleFact("cannot perform assertions on the contents of a null array")); return ignoreCheck().that(emptyList()); } return checkNoNeedToDisplayBothValues("asList()").that(Shorts.asList(actual)); }
A subject for {@code short[]}. @author Christian Gruber (cgruber@israfil.net)
asList
java
google/truth
core/src/main/java/com/google/common/truth/PrimitiveShortArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/PrimitiveShortArraySubject.java
Apache-2.0
static Factory<PrimitiveShortArraySubject, short[]> shortArrays() { return PrimitiveShortArraySubject::new; }
Checks that the actual array has the given length.
shortArrays
java
google/truth
core/src/main/java/com/google/common/truth/PrimitiveShortArraySubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/PrimitiveShortArraySubject.java
Apache-2.0
public SubjectT that(@Nullable ActualT actual) { return subjectFactory.createSubject(metadata, actual); }
In a fluent assertion chain, exposes the most common {@code that} method, which accepts a value under test and returns a {@link Subject}. <p>For more information about the methods in this class, see <a href="https://truth.dev/faq#full-chain">this FAQ entry</a>. <h3>For people extending Truth</h3> <p>You won't extend...
that
java
google/truth
core/src/main/java/com/google/common/truth/SimpleSubjectBuilder.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SimpleSubjectBuilder.java
Apache-2.0
@CanIgnoreReturnValue static Error sneakyThrow(Throwable t) { throw new SneakyThrows<Error>().throwIt(t); }
Throws {@code t} as if it were an unchecked {@link Throwable}. <p>This method is useful primarily when we make a reflective call to a method with no {@code throws} clause: Java forces us to handle an arbitrary {@link Throwable} from that method, rather than just the {@link RuntimeException} or {@link Error} that shoul...
sneakyThrow
java
google/truth
core/src/main/java/com/google/common/truth/SneakyThrows.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SneakyThrows.java
Apache-2.0
@SuppressWarnings("unchecked") // not really safe, but that's the point private Error throwIt(Throwable t) throws T { throw (T) t; }
Throws {@code t} as if it were an unchecked {@link Throwable}. <p>This method is useful primarily when we make a reflective call to a method with no {@code throws} clause: Java forces us to handle an arbitrary {@link Throwable} from that method, rather than just the {@link RuntimeException} or {@link Error} that shoul...
throwIt
java
google/truth
core/src/main/java/com/google/common/truth/SneakyThrows.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SneakyThrows.java
Apache-2.0
static void cleanStackTrace(Throwable throwable) { new StackTraceCleaner(throwable).clean(newIdentityHashSet()); }
<b>Call {@link Platform#cleanStackTrace} rather than calling this directly.</b> <p>Cleans the stack trace on the given {@link Throwable}, replacing the original stack trace stored on the instance (see {@link Throwable#setStackTrace(StackTraceElement[])}). <p>Removes Truth stack frames from the top and JUnit framework...
cleanStackTrace
java
google/truth
core/src/main/java/com/google/common/truth/StackTraceCleaner.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StackTraceCleaner.java
Apache-2.0
@SuppressWarnings("SetAll") // not available under old versions of Android private void clean(Set<Throwable> seenThrowables) { // Stack trace cleaning can be disabled using a system property. if (isStackTraceCleaningDisabled()) { return; } /* * TODO(cpovirk): Consider wrapping this whole m...
Cleans the stack trace on {@code throwable}, replacing the trace that was originally on it.
clean
java
google/truth
core/src/main/java/com/google/common/truth/StackTraceCleaner.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StackTraceCleaner.java
Apache-2.0
private void addToStreak(StackTraceElementWrapper stackTraceElementWrapper) { if (stackTraceElementWrapper.getStackFrameType() != currentStreakType) { endStreak(); currentStreakType = stackTraceElementWrapper.getStackFrameType(); currentStreakLength = 1; } else { currentStreakLength++; ...
Either adds the given frame to the running streak or closes out the running streak and starts a new one.
addToStreak
java
google/truth
core/src/main/java/com/google/common/truth/StackTraceCleaner.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StackTraceCleaner.java
Apache-2.0
private void endStreak() { if (currentStreakLength == 0) { return; } if (currentStreakLength == 1) { // A single frame isn't a streak. Just include the frame as-is in the result. cleanedStackTrace.add(checkNotNull(lastStackFrameElementWrapper)); } else { // Add a single frame to...
Ends the current streak, adding a summary frame to the result. Resets the streak counter.
endStreak
java
google/truth
core/src/main/java/com/google/common/truth/StackTraceCleaner.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StackTraceCleaner.java
Apache-2.0
StackFrameType getStackFrameType() { return stackFrameType; }
Returns the type of this frame.
getStackFrameType
java
google/truth
core/src/main/java/com/google/common/truth/StackTraceCleaner.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StackTraceCleaner.java
Apache-2.0
private static StackFrameType forClassName(String fullyQualifiedClassName) { // Never remove the frames from a test class. These will probably be the frame of a failing // assertion. // TODO(cpovirk): This is really only for tests in Truth itself, so this doesn't matter yet, // but.... If the Tr...
Helper method to determine the frame type from the fully qualified class name.
forClassName
java
google/truth
core/src/main/java/com/google/common/truth/StackTraceCleaner.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StackTraceCleaner.java
Apache-2.0
String getName() { return name; }
Returns the name of this frame type to display in the cleaned trace
getName
java
google/truth
core/src/main/java/com/google/common/truth/StackTraceCleaner.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StackTraceCleaner.java
Apache-2.0
boolean belongsToType(String fullyQualifiedClassName) { for (String prefix : prefixes) { // TODO(cpovirk): Should we also check prefix + "$"? if (fullyQualifiedClassName.equals(prefix) || fullyQualifiedClassName.startsWith(prefix + ".")) { return true; } } ...
Returns true if the given frame belongs to this frame type based on the package and/or class name of the frame.
belongsToType
java
google/truth
core/src/main/java/com/google/common/truth/StackTraceCleaner.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StackTraceCleaner.java
Apache-2.0
private static boolean isStackTraceCleaningDisabled() { // Reading system properties might be forbidden. try { return Boolean.parseBoolean( System.getProperty("com.google.common.truth.disable_stack_trace_cleaning")); } catch (SecurityException e) { // Hope for the best. return fa...
Returns true if stack trace cleaning is explicitly disabled in a system property. This switch is intended to be used when attempting to debug the frameworks which are collapsed or filtered out of stack traces by the cleaner.
isStackTraceCleaningDisabled
java
google/truth
core/src/main/java/com/google/common/truth/StackTraceCleaner.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/StackTraceCleaner.java
Apache-2.0
public static StandardSubjectBuilder forCustomFailureStrategy(FailureStrategy failureStrategy) { return new StandardSubjectBuilder(FailureMetadata.forFailureStrategy(failureStrategy)); }
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}.
forCustomFailureStrategy
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 <ComparableT extends Comparable<?>> ComparableSubject<ComparableT> that( @Nullable ComparableT actual) { return about(ComparableSubject.<ComparableT>comparables()).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 BigDecimalSubject that(@Nullable BigDecimal actual) { return about(bigDecimals()).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 Subject that(@Nullable Object actual) { return about(objects()).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
@GwtIncompatible("ClassSubject.java") @J2ktIncompatible public final ClassSubject that(@Nullable Class<?> actual) { return about(classes()).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 ThrowableSubject that(@Nullable Throwable actual) { return about(throwables()).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 LongSubject that(@Nullable Long actual) { return about(longs()).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 DoubleSubject that(@Nullable Double actual) { return about(doubles()).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 FloatSubject that(@Nullable Float actual) { return about(floats()).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 IntegerSubject that(@Nullable Integer actual) { return about(integers()).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 BooleanSubject that(@Nullable Boolean actual) { return about(booleans()).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 StringSubject that(@Nullable String actual) { return about(strings()).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 IterableSubject that(@Nullable Iterable<?> actual) { return about(iterables()).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("AvoidObjectArrays") public final <T extends @Nullable Object> ObjectArraySubject<T> that(T @Nullable [] actual) { return about(ObjectArraySubject.<T>objectArrays()).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 PrimitiveBooleanArraySubject that(boolean @Nullable [] actual) { return about(booleanArrays()).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 PrimitiveShortArraySubject that(short @Nullable [] actual) { return about(shortArrays()).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