Package com.google.common.truth
Class AbstractArraySubject
- java.lang.Object
-
- com.google.common.truth.Subject
-
- com.google.common.truth.AbstractArraySubject
-
- Direct Known Subclasses:
ObjectArraySubject
,PrimitiveBooleanArraySubject
,PrimitiveByteArraySubject
,PrimitiveCharArraySubject
,PrimitiveDoubleArraySubject
,PrimitiveFloatArraySubject
,PrimitiveIntArraySubject
,PrimitiveLongArraySubject
,PrimitiveShortArraySubject
abstract class AbstractArraySubject extends Subject
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.EqualityCheck, Subject.Factory<SubjectT extends Subject,ActualT>
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object
actual
-
Constructor Summary
Constructors Constructor Description AbstractArraySubject(FailureMetadata metadata, java.lang.Object actual, java.lang.String typeDescription)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
hasLength(int length)
Fails if the array does not have the given length.void
isEmpty()
Fails if the array is not empty (i.e.void
isNotEmpty()
Fails if the array is empty (i.e.private int
length()
-
Methods inherited from class com.google.common.truth.Subject
actual, actualCustomStringRepresentation, actualCustomStringRepresentationForPackageMembersToCall, butWas, check, check, checkNoNeedToDisplayBothValues, equals, fail, fail, fail, failEqualityCheckForEqualsWithoutDescription, failWithActual, failWithActual, failWithActual, failWithActual, failWithBadResults, failWithCustomSubject, failWithoutActual, failWithoutActual, failWithoutActual, failWithoutActual, failWithoutSubject, hashCode, ignoreCheck, isAnyOf, isEqualTo, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameInstanceAs, isNull, isSameInstanceAs, toString, typeDescription
-
-
-
-
Constructor Detail
-
AbstractArraySubject
AbstractArraySubject(FailureMetadata metadata, java.lang.Object actual, java.lang.String typeDescription)
-
-
Method Detail
-
isEmpty
public final void isEmpty()
Fails if the array is not empty (i.e.array.length > 0
).
-
isNotEmpty
public final void isNotEmpty()
Fails if the array is empty (i.e.array.length == 0
).
-
hasLength
public final void hasLength(int length)
Fails if the array does not have the given length.- Throws:
java.lang.IllegalArgumentException
- iflength < 0
-
length
private int length()
-
-