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
protected final StandardSubjectBuilder ignoreCheck() { return StandardSubjectBuilder.forCustomFailureStrategy(failure -> {}); }
Begins a new call chain that ignores any failures. This is useful for subjects that normally delegate with to other subjects by using {@link #check} but have already reported a failure. In such cases it may still be necessary to return a {@code Subject} instance even though any subsequent assertions are meaningless. Fo...
ignoreCheck
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 void failWithActual(String key, @Nullable Object value) { failWithActual(fact(key, value)); }
Fails, reporting a message with two "{@linkplain Fact facts}": <ul> <li><i>key</i>: <i>value</i> <li>but was: <i>actual value</i>. </ul> <p>This is the simplest failure API. For more advanced needs, see {@linkplain #failWithActual(Fact, Fact...) the other overload} and {@link #failWithoutActual(Fact, Fact...) fai...
failWithActual
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 void failWithActual(Fact first, Fact... rest) { metadata.fail(sandwich(first, rest, butWas())); }
Fails, reporting a message with the given facts, followed by an automatically added fact of the form: <ul> <li>but was: <i>actual value</i>. </ul> <p>If you have only one fact to report (and it's a {@linkplain Fact#fact key-value fact}), prefer {@linkplain #failWithActual(String, Object) the simpler overload}. <p>...
failWithActual
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 void failWithActual(Iterable<Fact> facts) { metadata.fail(append(ImmutableList.copyOf(facts), butWas())); }
Internal variant of {@link #failWithActual(Fact, Fact...)} that accepts an {@link Iterable}. <p><b>Note:</b> While Truth's {@code fail*()} methods usually throw {@link AssertionError}, they do not do so in all cases: When users use an alternative {@link FailureStrategy}, such as {@link Expect}, the {@code fail*()} met...
failWithActual
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 void fail(String check) { fail(check, new Object[0]); }
Legacy failure method. Prefer the {@code fail*Actual(...)} family of methods. <p><b>Note:</b> While Truth's {@code fail*()} methods usually throw {@link AssertionError}, they do not do so in all cases: When users use an alternative {@link FailureStrategy}, such as {@link Expect}, the {@code fail*()} methods may instea...
fail
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 void fail(String verb, Object other) { fail(verb, new Object[] {other}); }
Legacy failure method. Prefer the {@code fail*Actual(...)} family of methods. <p><b>Note:</b> While Truth's {@code fail*()} methods usually throw {@link AssertionError}, they do not do so in all cases: When users use an alternative {@link FailureStrategy}, such as {@link Expect}, the {@code fail*()} methods may instea...
fail
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 void fail(String verb, @Nullable Object... messageParts) { StringBuilder message = new StringBuilder("Not true that <"); message.append(actualCustomStringRepresentation()).append("> ").append(verb); for (Object part : messageParts) { message.append(" <").append(part).append(">"); ...
Legacy failure method. Prefer the {@code fail*Actual(...)} family of methods. <p><b>Note:</b> While Truth's {@code fail*()} methods usually throw {@link AssertionError}, they do not do so in all cases: When users use an alternative {@link FailureStrategy}, such as {@link Expect}, the {@code fail*()} methods may instea...
fail
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 void failEqualityCheckForEqualsWithoutDescription(@Nullable Object expected) { failEqualityCheck(EqualityCheck.EQUAL, expected, ComparisonResult.differentNoDescription()); }
Special version of {@link #failEqualityCheck} for use from {@link IterableSubject}, documented further there. <p><b>Note:</b> While Truth's {@code fail*()} methods usually throw {@link AssertionError}, they do not do so in all cases: When users use an alternative {@link FailureStrategy}, such as {@link Expect}, the {@...
failEqualityCheckForEqualsWithoutDescription
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 failEqualityCheck( EqualityCheck equalityCheck, @Nullable Object expected, ComparisonResult difference) { String actualString = actualCustomStringRepresentation(); String expectedString = formatActualOrExpected(expected); String actualClass = actual == null ? "(null reference)" : actual.g...
Fails, potentially producing a {@code ComparisonFailure}. <p><b>Note:</b> While Truth's {@code fail*()} methods usually throw {@link AssertionError}, they do not do so in all cases: When users use an alternative {@link FailureStrategy}, such as {@link Expect}, the {@code fail*()} methods may instead record the failure...
failEqualityCheck
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 boolean tryFailForTrailingWhitespaceOnly(@Nullable Object expected) { if (!(actual instanceof String) || !(expected instanceof String)) { return false; } /* * TODO(cpovirk): Consider applying this for non-String types. The danger there is that we don't * know whether toString() (or ...
Checks whether the actual and expected values are strings that match except for trailing whitespace. If so, reports a failure and returns true.
tryFailForTrailingWhitespaceOnly
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 escapeWhitespace(String in) { StringBuilder out = new StringBuilder(); for (char c : in.toCharArray()) { out.append(escapeWhitespace(c)); } return out.toString(); }
Checks whether the actual and expected values are strings that match except for trailing whitespace. If so, reports a failure and returns true.
escapeWhitespace
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 boolean tryFailForEmptyString(@Nullable Object expected) { if (!(actual instanceof String) || !(expected instanceof String)) { return false; } String actualString = (String) actual; String expectedString = (String) expected; if (actualString.isEmpty()) { failWithoutActual(fact("...
Checks whether the actual and expected values are empty strings. If so, reports a failure and returns true.
tryFailForEmptyString
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 char[] asUnicodeHexEscape(char c) { // Equivalent to String.format("\\u%04x", (int) c); char[] r = new char[6]; r[0] = '\\'; r[1] = 'u'; r[5] = hexDigitsLower[c & 0xF]; c = (char) (c >>> 4); r[4] = hexDigitsLower[c & 0xF]; c = (char) (c >>> 4); r[3] = hexDigitsLower[c ...
Checks whether the actual and expected values are empty strings. If so, reports a failure and returns true.
asUnicodeHexEscape
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 failEqualityCheckNoComparisonFailure(ComparisonResult difference, Fact... facts) { // TODO(cpovirk): Is it possible for difference.factsOrEmpty() to be nonempty? If not, remove. metadata.fail(concat(asList(facts), difference.factsOrEmpty())); }
Checks whether the actual and expected values are empty strings. If so, reports a failure and returns true.
failEqualityCheckNoComparisonFailure
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 void failWithBadResults( String verb, @Nullable Object expected, String failVerb, @Nullable Object actual) { String message = lenientFormat( "Not true that <%s> %s <%s>. It %s <%s>", actualCustomStringRepresentation(), verb, expected,...
Legacy failure method. Prefer the {@code fail*Actual(...)} family of methods. <p><b>Note:</b> While Truth's {@code fail*()} methods usually throw {@link AssertionError}, they do not do so in all cases: When users use an alternative {@link FailureStrategy}, such as {@link Expect}, the {@code fail*()} methods may instea...
failWithBadResults
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 void failWithCustomSubject( String verb, @Nullable Object expected, @Nullable Object actual) { String message = lenientFormat( "Not true that <%s> %s <%s>", actual == null ? "null reference" : actual, verb, expected); failWithoutActual(simpleFact(message...
Legacy failure method that accepts an alternative representation of the actual value. Prefer the {@code fail*Actual(...)} family of methods. <p><b>Note:</b> While Truth's {@code fail*()} methods usually throw {@link AssertionError}, they do not do so in all cases: When users use an alternative {@link FailureStrategy},...
failWithCustomSubject
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 void failWithoutSubject(String check) { failWithoutActual(simpleFact(lenientFormat("Not true that the subject %s", check))); }
Legacy failure method. Prefer the {@code fail*Actual(...)} family of methods. <p><b>Note:</b> While Truth's {@code fail*()} methods usually throw {@link AssertionError}, they do not do so in all cases: When users use an alternative {@link FailureStrategy}, such as {@link Expect}, the {@code fail*()} methods may instea...
failWithoutSubject
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 void failWithoutActual(Fact first, Fact... rest) { metadata.fail(ImmutableList.copyOf(Lists.asList(first, rest))); }
Fails, reporting a message with the given facts, <i>without automatically adding the actual value.</i> <p>Most failure messages should report the actual value, so most checks should call {@link #failWithActual(Fact, Fact...) failWithActual} instead. However, {@code failWithoutActual} is useful in some cases: <ul> <...
failWithoutActual
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 void failWithoutActual(String check) { failWithoutSubject(check); }
Legacy failure method that excludes the actual value. Prefer the {@code fail*Actual(...)} family of methods. <p><b>Note:</b> While Truth's {@code fail*()} methods usually throw {@link AssertionError}, they do not do so in all cases: When users use an alternative {@link FailureStrategy}, such as {@link Expect}, the {@c...
failWithoutActual
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
@DoNotCall( "Subject.equals() is not supported. Did you mean to call" + " assertThat(actual).isEqualTo(expected) instead of" + " assertThat(actual).equals(expected)?") @Deprecated @Override public final boolean equals(@Nullable Object o) { throw new UnsupportedOperationException( ...
@throws UnsupportedOperationException always @deprecated {@link Object#equals(Object)} is not supported on Truth subjects. If you are writing a test assertion (actual vs. expected), use {@link #isEqualTo(Object)} instead.
equals
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
@DoNotCall("Subject.hashCode() is not supported.") @Deprecated @Override public final int hashCode() { throw new UnsupportedOperationException("Subject.hashCode() is not supported."); }
@throws UnsupportedOperationException always @deprecated {@link Object#hashCode()} is not supported on Truth subjects.
hashCode
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 @Override public String toString() { throw new UnsupportedOperationException( "Subject.toString() is not supported. Did you mean to call assertThat(foo.toString())" + " instead of assertThat(foo).toString()?"); }
@throws UnsupportedOperationException always @deprecated {@link Object#toString()} is not supported on Truth subjects.
toString
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 Fact butWas() { return fact("but was", actualCustomStringRepresentation()); }
Returns a "but was: <actual value>" string. This method should be rarely needed, since Truth inserts a "but was" fact by default for assertions. However, it's occasionally useful for calls to {@code failWithoutActual} that want a "but was" fact but don't want it to come last, where Truth inserts it by default.
butWas
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 typeDescription() { return typeDescriptionOrGuess(getClass(), typeDescriptionOverride); }
Returns a "but was: <actual value>" string. This method should be rarely needed, since Truth inserts a "but was" fact by default for assertions. However, it's occasionally useful for calls to {@code failWithoutActual} that want a "but was" fact but don't want it to come last, where Truth inserts it by default.
typeDescription
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 void arrayIsEmptyImpl() { if (actual == null) { failWithActual(simpleFact("expected an empty array")); } else if (getLength(actual) > 0) { failWithActual(simpleFact("expected to be empty")); } }
Returns a "but was: <actual value>" string. This method should be rarely needed, since Truth inserts a "but was" fact by default for assertions. However, it's occasionally useful for calls to {@code failWithoutActual} that want a "but was" fact but don't want it to come last, where Truth inserts it by default.
arrayIsEmptyImpl
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 void arrayIsNotEmptyImpl() { if (actual == null) { failWithActual(simpleFact("expected a nonempty array")); } else if (getLength(actual) == 0) { failWithoutActual(simpleFact("expected not to be empty")); } }
Returns a "but was: <actual value>" string. This method should be rarely needed, since Truth inserts a "but was" fact by default for assertions. However, it's occasionally useful for calls to {@code failWithoutActual} that want a "but was" fact but don't want it to come last, where Truth inserts it by default.
arrayIsNotEmptyImpl
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 void arrayHasLengthImpl(int length) { if (length < 0) { failWithoutActual( simpleFact("could not perform length check because expected length is negative"), fact("expected length", length), fact("array was", actualCustomStringRepresentationForPackageMembersToCall())); }...
Returns a "but was: <actual value>" string. This method should be rarely needed, since Truth inserts a "but was" fact by default for assertions. However, it's occasionally useful for calls to {@code failWithoutActual} that want a "but was" fact but don't want it to come last, where Truth inserts it by default.
arrayHasLengthImpl
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 typeDescriptionOrGuess( Class<? extends Subject> clazz, @Nullable String typeDescriptionOverride) { if (typeDescriptionOverride != null) { return typeDescriptionOverride; } /* * j2cl doesn't store enough metadata to know whether "Foo$BarSubject" is a nested class, so i...
Returns a "but was: <actual value>" string. This method should be rarely needed, since Truth inserts a "but was" fact by default for assertions. However, it's occasionally useful for calls to {@code failWithoutActual} that want a "but was" fact but don't want it to come last, where Truth inserts it by default.
typeDescriptionOrGuess
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 Factory<Subject, Object> objects() { return Subject::new; }
Returns a "but was: <actual value>" string. This method should be rarely needed, since Truth inserts a "but was" fact by default for assertions. However, it's occasionally useful for calls to {@code failWithoutActual} that want a "but was" fact but don't want it to come last, where Truth inserts it by default.
objects
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 <T extends @Nullable Object> List<T> accumulate(T first, T second, T @Nullable [] rest) { // rest should never be deliberately null, so assume that the caller passed null // in the third position but intended it to be the third element in the array of values. // Javac makes the opposite inference, so...
Utility methods used in {@code Subject} implementors. @author Christian Gruber @author Jens Nyman
accumulate
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
static String countDuplicates(Iterable<?> items) { /* * TODO(cpovirk): Remove brackets after migrating all callers to the new message format. But * will that look OK when we put the result next to a homogeneous type name? If not, maybe move * the homogeneous type name to a separate Fact? */ ...
Utility methods used in {@code Subject} implementors. @author Christian Gruber @author Jens Nyman
countDuplicates
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
static String entryString(Multiset.Entry<?> entry) { int count = entry.getCount(); String item = String.valueOf(entry.getElement()); return (count > 1) ? item + " [" + count + " copies]" : item; }
Utility methods used in {@code Subject} implementors. @author Christian Gruber @author Jens Nyman
entryString
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
private static <T extends @Nullable Object> NonHashingMultiset<T> countDuplicatesToMultiset( Iterable<T> items) { // We use avoid hashing in case the elements don't have a proper // .hashCode() method (e.g., MessageSet from old versions of protobuf). NonHashingMultiset<T> multiset = NonHashingMultiset...
Utility methods used in {@code Subject} implementors. @author Christian Gruber @author Jens Nyman
countDuplicatesToMultiset
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
static String countDuplicatesAndAddTypeInfo(Iterable<?> itemsIterable) { Collection<?> items = iterableToCollection(itemsIterable); String homogeneousTypeName = getHomogeneousTypeName(items); return homogeneousTypeName != null ? lenientFormat("%s (%s)", countDuplicates(items), homogeneousTypeName) ...
Makes a String representation of {@code items} with collapsed duplicates and additional class info. <p>Example: {@code countDuplicatesAndAddTypeInfo([1, 2, 2, 3]) == "[1, 2 [3 copies]] (java.lang.Integer)"} and {@code countDuplicatesAndAddTypeInfo([1, 2L]) == "[1 (java.lang.Integer), 2 (java.lang.Long)]"}.
countDuplicatesAndAddTypeInfo
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
static DuplicateGroupedAndTyped countDuplicatesAndMaybeAddTypeInfoReturnObject( Iterable<?> itemsIterable, boolean addTypeInfo) { if (addTypeInfo) { Collection<?> items = iterableToCollection(itemsIterable); String homogeneousTypeName = getHomogeneousTypeName(items); NonHashingMultiset<?> v...
Similar to {@link #countDuplicatesAndAddTypeInfo} and {@link #countDuplicates} but (a) only adds type info if requested and (b) returns a richer object containing the data.
countDuplicatesAndMaybeAddTypeInfoReturnObject
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
int totalCopies() { return contents.size(); }
Similar to {@link #countDuplicatesAndAddTypeInfo} and {@link #countDuplicates} but (a) only adds type info if requested and (b) returns a richer object containing the data.
totalCopies
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
boolean isEmpty() { return contents.isEmpty(); }
Similar to {@link #countDuplicatesAndAddTypeInfo} and {@link #countDuplicates} but (a) only adds type info if requested and (b) returns a richer object containing the data.
isEmpty
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
Iterable<Multiset.Entry<?>> entrySet() { return transform(contents.entrySet(), this::unwrapKey); }
Similar to {@link #countDuplicatesAndAddTypeInfo} and {@link #countDuplicates} but (a) only adds type info if requested and (b) returns a richer object containing the data.
entrySet
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
String toStringWithBrackets() { List<String> parts = new ArrayList<>(); for (Multiset.Entry<?> entry : entrySet()) { parts.add(entryString(entry)); } return parts.toString(); }
Similar to {@link #countDuplicatesAndAddTypeInfo} and {@link #countDuplicates} but (a) only adds type info if requested and (b) returns a richer object containing the data.
toStringWithBrackets
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
@Override public String toString() { String withBrackets = toStringWithBrackets(); return withBrackets.substring(1, withBrackets.length() - 1); }
Similar to {@link #countDuplicatesAndAddTypeInfo} and {@link #countDuplicates} but (a) only adds type info if requested and (b) returns a richer object containing the data.
toString
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
private Multiset.Entry<?> unwrapKey(Multiset.Entry<Wrapper<E>> input) { return immutableEntry(input.getElement().get(), input.getCount()); }
Similar to {@link #countDuplicatesAndAddTypeInfo} and {@link #countDuplicates} but (a) only adds type info if requested and (b) returns a richer object containing the data.
unwrapKey
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
@Override protected boolean doEquivalent(Object a, Object b) { return Objects.equals(a, b); }
Similar to {@link #countDuplicatesAndAddTypeInfo} and {@link #countDuplicates} but (a) only adds type info if requested and (b) returns a richer object containing the data.
doEquivalent
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
@Override protected int doHash(Object o) { return 0; // slow but hopefully not much worse than what we get with a flat list }
Similar to {@link #countDuplicatesAndAddTypeInfo} and {@link #countDuplicates} but (a) only adds type info if requested and (b) returns a richer object containing the data.
doHash
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
static <E extends @Nullable Object> NonHashingMultiset<E> create() { return new NonHashingMultiset<>(); }
Similar to {@link #countDuplicatesAndAddTypeInfo} and {@link #countDuplicates} but (a) only adds type info if requested and (b) returns a richer object containing the data.
create
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
@Nullable String getHomogeneousTypeToDisplay() { return homogeneousTypeToDisplay; }
Missing or unexpected values from a collection assertion, with equal objects grouped together and, in some cases, type information added. If the type information is present, it is either present in {@code homogeneousTypeToDisplay} (if all objects have the same type) or appended to each individual element (if some eleme...
getHomogeneousTypeToDisplay
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
int totalCopies() { return valuesAndMaybeTypes.totalCopies(); }
Missing or unexpected values from a collection assertion, with equal objects grouped together and, in some cases, type information added. If the type information is present, it is either present in {@code homogeneousTypeToDisplay} (if all objects have the same type) or appended to each individual element (if some eleme...
totalCopies
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
boolean isEmpty() { return valuesAndMaybeTypes.isEmpty(); }
Missing or unexpected values from a collection assertion, with equal objects grouped together and, in some cases, type information added. If the type information is present, it is either present in {@code homogeneousTypeToDisplay} (if all objects have the same type) or appended to each individual element (if some eleme...
isEmpty
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
Iterable<Multiset.Entry<?>> entrySet() { return valuesAndMaybeTypes.entrySet(); }
Missing or unexpected values from a collection assertion, with equal objects grouped together and, in some cases, type information added. If the type information is present, it is either present in {@code homogeneousTypeToDisplay} (if all objects have the same type) or appended to each individual element (if some eleme...
entrySet
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
@Override public String toString() { return homogeneousTypeToDisplay != null ? valuesAndMaybeTypes + " (" + homogeneousTypeToDisplay + ")" : valuesAndMaybeTypes.toString(); }
Missing or unexpected values from a collection assertion, with equal objects grouped together and, in some cases, type information added. If the type information is present, it is either present in {@code homogeneousTypeToDisplay} (if all objects have the same type) or appended to each individual element (if some eleme...
toString
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
static DuplicateGroupedAndTyped create( NonHashingMultiset<?> valuesAndMaybeTypes, @Nullable String homogeneousTypeToDisplay) { return new DuplicateGroupedAndTyped(valuesAndMaybeTypes, homogeneousTypeToDisplay); }
Missing or unexpected values from a collection assertion, with equal objects grouped together and, in some cases, type information added. If the type information is present, it is either present in {@code homogeneousTypeToDisplay} (if all objects have the same type) or appended to each individual element (if some eleme...
create
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
static List<@Nullable Object> retainMatchingToString( Iterable<?> items, Iterable<?> itemsToCheck) { ListMultimap<String, @Nullable Object> stringValueToItemsToCheck = ArrayListMultimap.create(); for (Object itemToCheck : itemsToCheck) { stringValueToItemsToCheck.put(String.valueOf(itemToCheck), ite...
Returns a new collection containing all elements in {@code items} for which there exists at least one element in {@code itemsToCheck} that has the same {@code toString()} value without being equal. <p>Example: {@code retainMatchingToString([1L, 2L, 2L], [2, 3]) == [2L, 2L]}
retainMatchingToString
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
static boolean hasMatchingToStringPair(Iterable<?> items1, Iterable<?> items2) { // Bail early for empty iterables to avoid calling hashCode() on the elements unnecessarily. return !isEmpty(items1) && !isEmpty(items2) && !retainMatchingToString(items1, items2).isEmpty(); }
Returns true if there is a pair of an item from {@code items1} and one in {@code items2} that has the same {@code toString()} value without being equal. <p>Example: {@code hasMatchingToStringPair([1L, 2L], [1]) == true}
hasMatchingToStringPair
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
static String objectToTypeName(@Nullable Object item) { // TODO(cpovirk): Merge this with the code in Subject.failEqualityCheck(). if (item == null) { // The name "null type" comes from the interface javax.lang.model.type.NullType. return "null type"; } else if (item instanceof Map.Entry) { ...
Returns true if there is a pair of an item from {@code items1} and one in {@code items2} that has the same {@code toString()} value without being equal. <p>Example: {@code hasMatchingToStringPair([1L, 2L], [1]) == true}
objectToTypeName
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
private static @Nullable String getHomogeneousTypeName(Iterable<?> items) { String homogeneousTypeName = null; for (Object item : items) { if (item == null) { /* * TODO(cpovirk): Why? We could have multiple nulls, which would be homogeneous. More * likely, we could have exactly o...
Returns the name of the single type of all given items or {@code null} if no such type exists.
getHomogeneousTypeName
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
private static List<String> addTypeInfoToEveryItem(Iterable<?> items) { List<String> itemsWithTypeInfo = new ArrayList<>(); for (Object item : items) { itemsWithTypeInfo.add(lenientFormat("%s (%s)", item, objectToTypeName(item))); } return itemsWithTypeInfo; }
Returns the name of the single type of all given items or {@code null} if no such type exists.
addTypeInfoToEveryItem
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
static <T extends @Nullable Object> Collection<T> iterableToCollection( @Nullable Iterable<T> iterable) { // TODO(cpovirk): For null inputs, produce a better exception message (ideally in callers). checkNotNull(iterable); if (iterable instanceof Collection) { // Should be safe to assume that any...
Returns the name of the single type of all given items or {@code null} if no such type exists.
iterableToCollection
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
static <T extends @Nullable Object> List<T> iterableToList(Iterable<T> iterable) { if (iterable instanceof List) { return (List<T>) iterable; } else { return Lists.newArrayList(iterable); } }
Returns the name of the single type of all given items or {@code null} if no such type exists.
iterableToList
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
static <T extends @Nullable Object> Iterable<T> annotateEmptyStrings(Iterable<T> items) { if (Iterables.contains(items, "")) { List<T> annotatedItems = new ArrayList<>(); for (T item : items) { if (Objects.equals(item, "")) { // This is a safe cast because know that at least one instan...
Returns an iterable with all empty strings replaced by a non-empty human understandable indicator for an empty string. <p>Returns the given iterable if it contains no empty strings.
annotateEmptyStrings
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
@SafeVarargs static <E> ImmutableList<E> concat(Iterable<? extends E>... inputs) { return ImmutableList.copyOf(Iterables.concat(inputs)); }
Returns an iterable with all empty strings replaced by a non-empty human understandable indicator for an empty string. <p>Returns the given iterable if it contains no empty strings.
concat
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
static <E> ImmutableList<E> append(E[] array, E e) { return new ImmutableList.Builder<E>().add(array).add(e).build(); }
Returns an iterable with all empty strings replaced by a non-empty human understandable indicator for an empty string. <p>Returns the given iterable if it contains no empty strings.
append
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
static <E> ImmutableList<E> append(ImmutableList<? extends E> list, E e) { return new ImmutableList.Builder<E>().addAll(list).add(e).build(); }
Returns an iterable with all empty strings replaced by a non-empty human understandable indicator for an empty string. <p>Returns the given iterable if it contains no empty strings.
append
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
static <E> ImmutableList<E> sandwich(E first, E[] array, E last) { return new ImmutableList.Builder<E>().add(first).add(array).add(last).build(); }
Returns an iterable with all empty strings replaced by a non-empty human understandable indicator for an empty string. <p>Returns the given iterable if it contains no empty strings.
sandwich
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
@SuppressWarnings("nullness") // TODO: b/316358623 - Remove suppression after fixing checker static <E extends @Nullable Object> List<E> asList(E... a) { return Arrays.asList(a); }
Returns an iterable with all empty strings replaced by a non-empty human understandable indicator for an empty string. <p>Returns the given iterable if it contains no empty strings.
asList
java
google/truth
core/src/main/java/com/google/common/truth/SubjectUtils.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/SubjectUtils.java
Apache-2.0
public void isEmpty() { if (!checkNotNull(actual).isEmpty()) { failWithActual(simpleFact("expected to be empty")); } }
Checks that the actual table is empty.
isEmpty
java
google/truth
core/src/main/java/com/google/common/truth/TableSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/TableSubject.java
Apache-2.0
public void isNotEmpty() { if (checkNotNull(actual).isEmpty()) { failWithoutActual(simpleFact("expected not to be empty")); } }
Checks that the actual table is not empty.
isNotEmpty
java
google/truth
core/src/main/java/com/google/common/truth/TableSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/TableSubject.java
Apache-2.0
public void hasSize(int expectedSize) { checkArgument(expectedSize >= 0, "expectedSize(%s) must be >= 0", expectedSize); check("size()").that(checkNotNull(actual).size()).isEqualTo(expectedSize); }
Checks that the actual table has the given size.
hasSize
java
google/truth
core/src/main/java/com/google/common/truth/TableSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/TableSubject.java
Apache-2.0
public void contains(@Nullable Object rowKey, @Nullable Object columnKey) { if (!checkNotNull(actual).contains(rowKey, columnKey)) { /* * TODO(cpovirk): Consider including information about whether any cell with the given row * *or* column was present. */ failWithActual( s...
Checks that the actual table contains a mapping for the given row key and column key.
contains
java
google/truth
core/src/main/java/com/google/common/truth/TableSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/TableSubject.java
Apache-2.0
public void doesNotContain(@Nullable Object rowKey, @Nullable Object columnKey) { if (checkNotNull(actual).contains(rowKey, columnKey)) { failWithoutActual( simpleFact("expected not to contain mapping for row-column key pair"), fact("row key", rowKey), fact("column key", columnKe...
Checks that the actual table does not contain a mapping for the given row key and column key.
doesNotContain
java
google/truth
core/src/main/java/com/google/common/truth/TableSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/TableSubject.java
Apache-2.0
public void containsCell( @Nullable Object rowKey, @Nullable Object colKey, @Nullable Object value) { containsCell( Tables.<@Nullable Object, @Nullable Object, @Nullable Object>immutableCell( rowKey, colKey, value)); }
Checks that the actual table contains the given cell.
containsCell
java
google/truth
core/src/main/java/com/google/common/truth/TableSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/TableSubject.java
Apache-2.0
public void containsCell(Cell<?, ?, ?> cell) { checkNotNull(cell); checkNoNeedToDisplayBothValues("cellSet()").that(checkNotNull(actual).cellSet()).contains(cell); }
Checks that the actual table contains the given cell.
containsCell
java
google/truth
core/src/main/java/com/google/common/truth/TableSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/TableSubject.java
Apache-2.0
public void doesNotContainCell( @Nullable Object rowKey, @Nullable Object colKey, @Nullable Object value) { doesNotContainCell( Tables.<@Nullable Object, @Nullable Object, @Nullable Object>immutableCell( rowKey, colKey, value)); }
Checks that the actual table does not contain the given cell.
doesNotContainCell
java
google/truth
core/src/main/java/com/google/common/truth/TableSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/TableSubject.java
Apache-2.0
public void doesNotContainCell(Cell<?, ?, ?> cell) { checkNotNull(cell); checkNoNeedToDisplayBothValues("cellSet()") .that(checkNotNull(actual).cellSet()) .doesNotContain(cell); }
Checks that the actual table does not contain the given cell.
doesNotContainCell
java
google/truth
core/src/main/java/com/google/common/truth/TableSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/TableSubject.java
Apache-2.0
static Factory<TableSubject, Table<?, ?, ?>> tables() { return TableSubject::new; }
Checks that the actual table contains the given value.
tables
java
google/truth
core/src/main/java/com/google/common/truth/TableSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/TableSubject.java
Apache-2.0
public final StringSubject hasMessageThat() { // We provide a more helpful error message if hasCauseThat() methods are chained too deep, as in // assertThat(new Exception()).hasCauseThat().hasMessageThat().... // This message also triggers for the simpler case of assertThat(null).hasMessageThat().... if...
Returns a {@code StringSubject} to make assertions about the throwable's message.
hasMessageThat
java
google/truth
core/src/main/java/com/google/common/truth/ThrowableSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/ThrowableSubject.java
Apache-2.0
@SuppressWarnings("ShouldNotSubclass") public final ThrowableSubject hasCauseThat() { // We provide a more helpful error message if hasCauseThat() methods are chained too deep, as in // assertThat(new Exception()).hasCauseThat().hasCauseThat().... // This message also triggers for the simpler case of asse...
Returns a new {@code ThrowableSubject} that supports assertions on this throwable's direct cause. This method can be invoked repeatedly (e.g. {@code assertThat(e).hasCauseThat().hasCauseThat()....} to assert on a particular indirect cause.
hasCauseThat
java
google/truth
core/src/main/java/com/google/common/truth/ThrowableSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/ThrowableSubject.java
Apache-2.0
@Override @SuppressWarnings("UnsynchronizedOverridesSynchronized") public Throwable fillInStackTrace() { setStackTrace(new StackTraceElement[0]); // for old versions of Android return this; }
Returns a new {@code ThrowableSubject} that supports assertions on this throwable's direct cause. This method can be invoked repeatedly (e.g. {@code assertThat(e).hasCauseThat().hasCauseThat()....} to assert on a particular indirect cause.
fillInStackTrace
java
google/truth
core/src/main/java/com/google/common/truth/ThrowableSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/ThrowableSubject.java
Apache-2.0
static Factory<ThrowableSubject, Throwable> throwables() { return ThrowableSubject::new; }
Returns a new {@code ThrowableSubject} that supports assertions on this throwable's direct cause. This method can be invoked repeatedly (e.g. {@code assertThat(e).hasCauseThat().hasCauseThat()....} to assert on a particular indirect cause.
throwables
java
google/truth
core/src/main/java/com/google/common/truth/ThrowableSubject.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/ThrowableSubject.java
Apache-2.0
@SuppressWarnings("MemberName") // The underscore is a weird but intentional choice. public static StandardSubjectBuilder assert_() { return ASSERT; }
Begins a call chain with the fluent Truth API. If the check made by the chain fails, it will throw {@link AssertionError}.
assert_
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static StandardSubjectBuilder assertWithMessage(@Nullable String messageToPrepend) { return assert_().withMessage(messageToPrepend); }
Begins an assertion that, if it fails, will prepend the given message to the failure message. <p>This method is a shortcut for {@code assert_().withMessage(...)}. <p>To set a message when using a custom subject, use {@code assertWithMessage(...).}{@link StandardSubjectBuilder#about about(...)}, as discussed in <a hre...
assertWithMessage
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static StandardSubjectBuilder assertWithMessage(String format, @Nullable Object... args) { return assert_().withMessage(format, args); }
Begins an assertion that, if it fails, will prepend the given message to the failure message. <p><b>Note:</b> the arguments will be substituted into the format template using {@link com.google.common.base.Strings#lenientFormat Strings.lenientFormat}. Note this only supports the {@code %s} specifier. <p>This method is...
assertWithMessage
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static <S extends Subject, T> SimpleSubjectBuilder<S, T> assertAbout( Subject.Factory<S, T> factory) { return assert_().about(factory); }
Given a factory for some {@code Subject} class, returns a builder whose {@code that(actual)} method creates instances of that class.
assertAbout
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static <CustomSubjectBuilderT extends CustomSubjectBuilder> CustomSubjectBuilderT assertAbout( CustomSubjectBuilder.Factory<CustomSubjectBuilderT> factory) { return assert_().about(factory); }
A generic, advanced method of extension of Truth to new types, which is documented on {@link CustomSubjectBuilder}. Extension creators should prefer {@link Subject.Factory} if possible.
assertAbout
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static <ComparableT extends Comparable<?>> ComparableSubject<ComparableT> assertThat( @Nullable ComparableT actual) { return assert_().that(actual); }
Begins an assertion about a {@link Comparable}.
assertThat
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static BigDecimalSubject assertThat(@Nullable BigDecimal actual) { return assert_().that(actual); }
Begins an assertion about a {@link BigDecimal}.
assertThat
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static Subject assertThat(@Nullable Object actual) { return assert_().that(actual); }
Begins an assertion about an {@link Object}.
assertThat
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
@GwtIncompatible("ClassSubject.java") @J2ktIncompatible public static ClassSubject assertThat(@Nullable Class<?> actual) { return assert_().that(actual); }
Begins an assertion about a {@link Class}.
assertThat
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static ThrowableSubject assertThat(@Nullable Throwable actual) { return assert_().that(actual); }
Begins an assertion about a {@link Throwable}. <p>Truth does not provide its own support for calling a method and automatically catching an expected exception, only for asserting on the exception after it has been caught. To catch the exception, we suggest {@link org.junit.Assert#assertThrows(Class, org.junit.function...
assertThat
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static LongSubject assertThat(@Nullable Long actual) { return assert_().that(actual); }
Begins an assertion about a {@link Long}.
assertThat
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static DoubleSubject assertThat(@Nullable Double actual) { return assert_().that(actual); }
Begins an assertion about a {@link Double}.
assertThat
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static FloatSubject assertThat(@Nullable Float actual) { return assert_().that(actual); }
Begins an assertion about a {@link Float}.
assertThat
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static IntegerSubject assertThat(@Nullable Integer actual) { return assert_().that(actual); }
Begins an assertion about an {@link Integer}.
assertThat
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static BooleanSubject assertThat(@Nullable Boolean actual) { return assert_().that(actual); }
Begins an assertion about a {@link Boolean}.
assertThat
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static StringSubject assertThat(@Nullable String actual) { return assert_().that(actual); }
Begins an assertion about a {@link String}.
assertThat
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static IterableSubject assertThat(@Nullable Iterable<?> actual) { return assert_().that(actual); }
Begins an assertion about an {@link Iterable}.
assertThat
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
@SuppressWarnings("AvoidObjectArrays") public static <T extends @Nullable Object> ObjectArraySubject<T> assertThat( T @Nullable [] actual) { return assert_().that(actual); }
Begins an assertion about an {@link Object} array.
assertThat
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static PrimitiveBooleanArraySubject assertThat(boolean @Nullable [] actual) { return assert_().that(actual); }
Begins an assertion about a {@code boolean} array.
assertThat
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static PrimitiveShortArraySubject assertThat(short @Nullable [] actual) { return assert_().that(actual); }
Begins an assertion about a {@code short} array.
assertThat
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static PrimitiveIntArraySubject assertThat(int @Nullable [] actual) { return assert_().that(actual); }
Begins an assertion about an {@code int} array.
assertThat
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static PrimitiveLongArraySubject assertThat(long @Nullable [] actual) { return assert_().that(actual); }
Begins an assertion about a {@code long} array.
assertThat
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0
public static PrimitiveByteArraySubject assertThat(byte @Nullable [] actual) { return assert_().that(actual); }
Begins an assertion about a {@code byte} array.
assertThat
java
google/truth
core/src/main/java/com/google/common/truth/Truth.java
https://github.com/google/truth/blob/master/core/src/main/java/com/google/common/truth/Truth.java
Apache-2.0