Package com.google.common.truth
Class ObjectArraySubject<T>
- java.lang.Object
-
- com.google.common.truth.Subject<AbstractArraySubject<S,T>,T>
-
- com.google.common.truth.AbstractArraySubject<ObjectArraySubject<T>,T[]>
-
- com.google.common.truth.ObjectArraySubject<T>
-
public class ObjectArraySubject<T> extends AbstractArraySubject<ObjectArraySubject<T>,T[]>
A Subject to handle testing propositions forObject[]
and more genericallyT[]
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.truth.Subject
Subject.HasField
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
typeName
-
Fields inherited from class com.google.common.truth.Subject
failureStrategy
-
-
Constructor Summary
Constructors Constructor Description ObjectArraySubject(FailureStrategy failureStrategy, T[] o)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ListSubject<?,T,java.util.List<T>>
asList()
void
isEqualTo(java.lang.Object expected)
A proposition that the provided Object[] is an array of the same length and type, and contains elements such that each element inexpected
is equal to each element in the subject, and in the same position.void
isNotEqualTo(java.lang.Object expected)
Fails if the subject is equal to the given object.protected java.util.List<T>
listRepresentation()
private java.lang.String
typeNameFromInstance(java.lang.Object instance)
protected java.lang.String
underlyingType()
-
Methods inherited from class com.google.common.truth.AbstractArraySubject
failWithBadType, getDisplaySubject, hasLength, isEmpty, isNotEmpty, named
-
Methods inherited from class com.google.common.truth.Subject
check, equals, fail, fail, fail, failWithBadResults, failWithCustomSubject, failWithoutSubject, failWithRawMessage, getSubject, hasField, hashCode, internalCustomName, is, isA, isInstanceOf, isNotA, isNotInstanceOf, isNotNull, isNotSameAs, isNull, isSameAs, labeled
-
-
-
-
Constructor Detail
-
ObjectArraySubject
ObjectArraySubject(FailureStrategy failureStrategy, T[] o)
-
-
Method Detail
-
underlyingType
protected java.lang.String underlyingType()
- Specified by:
underlyingType
in classAbstractArraySubject<ObjectArraySubject<T>,T[]>
-
listRepresentation
protected java.util.List<T> listRepresentation()
- Specified by:
listRepresentation
in classAbstractArraySubject<ObjectArraySubject<T>,T[]>
-
typeNameFromInstance
private java.lang.String typeNameFromInstance(java.lang.Object instance)
-
isEqualTo
public void isEqualTo(java.lang.Object expected)
A proposition that the provided Object[] is an array of the same length and type, and contains elements such that each element inexpected
is equal to each element in the subject, and in the same position.- Overrides:
isEqualTo
in classSubject<AbstractArraySubject<ObjectArraySubject<T>,T[]>,T[]>
-
isNotEqualTo
public void isNotEqualTo(java.lang.Object expected)
Description copied from class:Subject
Fails if the subject is equal to the given object.- Overrides:
isNotEqualTo
in classSubject<AbstractArraySubject<ObjectArraySubject<T>,T[]>,T[]>
-
asList
public ListSubject<?,T,java.util.List<T>> asList()
-
-