public final class Truth extends Object
Compare these example JUnit assertions...
 assertEquals(b, a);
 assertTrue(c);
 assertTrue(d.contains(a));
 assertTrue(d.contains(a) && d.contains(b));
 assertTrue(d.contains(a) || d.contains(b) || d.contains(c));
 
 ...to their Truth equivalents...
 
 assertThat(a).isEqualTo(b);
 assertThat(c).isTrue();
 assertThat(d).contains(a);
 assertThat(d).containsAtLeast(a, b);
 assertThat(d).containsAnyOf(a, b, c);
 
 Advantages of Truth:
IterableSubject.containsExactly(java.lang.Object...))
 For more information about the methods in this class, see this FAQ entry.
The most common way to extend Truth is to write a custom Subject. (The other, much
 less common way is to write a custom FailureStrategy.) For more information, visit those
 types' docs.
| Modifier and Type | Method and Description | 
|---|---|
static StandardSubjectBuilder | 
assert_()
Begins a call chain with the fluent Truth API. 
 | 
static <CustomSubjectBuilderT extends CustomSubjectBuilder> | 
assertAbout(CustomSubjectBuilder.Factory<CustomSubjectBuilderT> factory)
A generic, advanced method of extension of Truth to new types, which is documented on  
CustomSubjectBuilder. | 
static <S extends Subject,T> | 
assertAbout(Subject.Factory<S,T> factory)
Given a factory for some  
Subject class, returns a builder whose that(actual)
 method creates instances of that class. | 
static AtomicLongMapSubject | 
assertThat(AtomicLongMap<?> actual)
Deprecated. 
 
Perform assertions on the  
AtomicLongMap.asMap() view. | 
static BigDecimalSubject | 
assertThat(BigDecimal actual)  | 
static BooleanSubject | 
assertThat(Boolean actual)  | 
static PrimitiveBooleanArraySubject | 
assertThat(boolean[] actual)  | 
static PrimitiveByteArraySubject | 
assertThat(byte[] actual)  | 
static PrimitiveCharArraySubject | 
assertThat(char[] actual)  | 
static ClassSubject | 
assertThat(Class<?> actual)  | 
static DoubleSubject | 
assertThat(Double actual)  | 
static PrimitiveDoubleArraySubject | 
assertThat(double[] actual)  | 
static FloatSubject | 
assertThat(Float actual)  | 
static PrimitiveFloatArraySubject | 
assertThat(float[] actual)  | 
static PrimitiveIntArraySubject | 
assertThat(int[] actual)  | 
static IntegerSubject | 
assertThat(Integer actual)  | 
static IterableSubject | 
assertThat(Iterable<?> actual)  | 
static LongSubject | 
assertThat(Long actual)  | 
static PrimitiveLongArraySubject | 
assertThat(long[] actual)  | 
static MapSubject | 
assertThat(Map<?,?> actual)  | 
static MultimapSubject | 
assertThat(Multimap<?,?> actual)  | 
static MultisetSubject | 
assertThat(Multiset<?> actual)  | 
static Subject | 
assertThat(Object actual)  | 
static GuavaOptionalSubject | 
assertThat(Optional<?> actual)  | 
static PrimitiveShortArraySubject | 
assertThat(short[] actual)  | 
static StringSubject | 
assertThat(String actual)  | 
static <T extends Comparable<?>> | 
assertThat(T actual)  | 
static <T> ObjectArraySubject<T> | 
assertThat(T[] actual)  | 
static TableSubject | 
assertThat(Table<?,?,?> actual)  | 
static ThrowableSubject | 
assertThat(Throwable actual)  | 
static StandardSubjectBuilder | 
assertWithMessage(String messageToPrepend)
Begins an assertion that, if it fails, will prepend the given message to the failure message. 
 | 
static StandardSubjectBuilder | 
assertWithMessage(String format,
                 Object... args)
Begins an assertion that, if it fails, will prepend the given message to the failure message. 
 | 
public static StandardSubjectBuilder assert_()
AssertionError.public static StandardSubjectBuilder assertWithMessage(String messageToPrepend)
This method is a shortcut for assert_().withMessage(...).
public static StandardSubjectBuilder assertWithMessage(String format, Object... args)
Note: the arguments will be substituted into the format template using Strings.lenientFormat. Note this only supports
 the %s specifier.
 
This method is a shortcut for assert_().withMessage(...).
IllegalArgumentException - if the number of placeholders in the format string does not
     equal the number of given argumentspublic static <S extends Subject,T> SimpleSubjectBuilder<S,T> assertAbout(Subject.Factory<S,T> factory)
Subject class, returns a builder whose that(actual)
 method creates instances of that class.public static <CustomSubjectBuilderT extends CustomSubjectBuilder> CustomSubjectBuilderT assertAbout(CustomSubjectBuilder.Factory<CustomSubjectBuilderT> factory)
CustomSubjectBuilder. Extension creators should prefer Subject.Factory if possible.public static <T extends Comparable<?>> ComparableSubject<T> assertThat(@NullableDecl T actual)
public static BigDecimalSubject assertThat(@NullableDecl BigDecimal actual)
@GwtIncompatible(value="ClassSubject.java") public static ClassSubject assertThat(@NullableDecl Class<?> actual)
public static ThrowableSubject assertThat(@NullableDecl Throwable actual)
public static LongSubject assertThat(@NullableDecl Long actual)
public static DoubleSubject assertThat(@NullableDecl Double actual)
public static FloatSubject assertThat(@NullableDecl Float actual)
public static IntegerSubject assertThat(@NullableDecl Integer actual)
public static BooleanSubject assertThat(@NullableDecl Boolean actual)
public static StringSubject assertThat(@NullableDecl String actual)
public static IterableSubject assertThat(@NullableDecl Iterable<?> actual)
public static <T> ObjectArraySubject<T> assertThat(@NullableDecl T[] actual)
public static PrimitiveBooleanArraySubject assertThat(@NullableDecl boolean[] actual)
public static PrimitiveShortArraySubject assertThat(@NullableDecl short[] actual)
public static PrimitiveIntArraySubject assertThat(@NullableDecl int[] actual)
public static PrimitiveLongArraySubject assertThat(@NullableDecl long[] actual)
public static PrimitiveByteArraySubject assertThat(@NullableDecl byte[] actual)
public static PrimitiveCharArraySubject assertThat(@NullableDecl char[] actual)
public static PrimitiveFloatArraySubject assertThat(@NullableDecl float[] actual)
public static PrimitiveDoubleArraySubject assertThat(@NullableDecl double[] actual)
public static GuavaOptionalSubject assertThat(@NullableDecl Optional<?> actual)
public static MapSubject assertThat(@NullableDecl Map<?,?> actual)
public static MultimapSubject assertThat(@NullableDecl Multimap<?,?> actual)
public static MultisetSubject assertThat(@NullableDecl Multiset<?> actual)
public static TableSubject assertThat(@NullableDecl Table<?,?,?> actual)
@Deprecated public static AtomicLongMapSubject assertThat(@NullableDecl AtomicLongMap<?> actual)
AtomicLongMap.asMap() view.Copyright © 2019. All rights reserved.