Package com.google.common.truth
Class AbstractArraySubject<S extends AbstractArraySubject<S,T>,T>
- java.lang.Object
-
- com.google.common.truth.Subject<AbstractArraySubject<S,T>,T>
-
- com.google.common.truth.AbstractArraySubject<S,T>
-
- Direct Known Subclasses:
ObjectArraySubject,PrimitiveBooleanArraySubject,PrimitiveByteArraySubject,PrimitiveCharArraySubject,PrimitiveDoubleArraySubject,PrimitiveFloatArraySubject,PrimitiveIntArraySubject,PrimitiveLongArraySubject
public abstract class AbstractArraySubject<S extends AbstractArraySubject<S,T>,T> extends Subject<AbstractArraySubject<S,T>,T>
A common supertype for Array subjects, abstracting some common display and error infrastructure.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.truth.Subject
Subject.HasField
-
-
Field Summary
-
Fields inherited from class com.google.common.truth.Subject
failureStrategy
-
-
Constructor Summary
Constructors Constructor Description AbstractArraySubject(FailureStrategy failureStrategy, T subject)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) voidfailWithBadType(java.lang.Object expected)protected java.lang.StringgetDisplaySubject()voidhasLength(int length)Fails if the array does not have the given length.voidisEmpty()Fails if the array is not empty (i.e.voidisNotEmpty()Fails if the array is empty (i.e.(package private) abstract java.util.List<?>listRepresentation()Snamed(java.lang.String name)Renames the subject so that this name appears in the error messages in place of string representations of the subject.(package private) abstract java.lang.StringunderlyingType()-
Methods inherited from class com.google.common.truth.Subject
check, equals, fail, fail, fail, failWithBadResults, failWithCustomSubject, failWithoutSubject, failWithRawMessage, getSubject, hasField, hashCode, internalCustomName, is, isA, isEqualTo, isInstanceOf, isNotA, isNotEqualTo, isNotInstanceOf, isNotNull, isNotSameAs, isNull, isSameAs, labeled
-
-
-
-
Constructor Detail
-
AbstractArraySubject
AbstractArraySubject(FailureStrategy failureStrategy, T subject)
-
-
Method Detail
-
isEmpty
public void isEmpty()
Fails if the array is not empty (i.e.array.length != 0).
-
isNotEmpty
public void isNotEmpty()
Fails if the array is empty (i.e.array.length == 0).
-
hasLength
public void hasLength(int length)
Fails if the array does not have the given length.
-
named
public S named(java.lang.String name)
Description copied from class:SubjectRenames the subject so that this name appears in the error messages in place of string representations of the subject.- Overrides:
namedin classSubject<AbstractArraySubject<S extends AbstractArraySubject<S,T>,T>,T>
-
underlyingType
abstract java.lang.String underlyingType()
-
listRepresentation
abstract java.util.List<?> listRepresentation()
-
getDisplaySubject
protected java.lang.String getDisplaySubject()
- Overrides:
getDisplaySubjectin classSubject<AbstractArraySubject<S extends AbstractArraySubject<S,T>,T>,T>
-
failWithBadType
void failWithBadType(java.lang.Object expected)
-
-