|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fest.assertions.Assert
org.fest.assertions.GenericAssert<S,A>
org.fest.assertions.GroupAssert<S,A>
org.fest.assertions.ItemGroupAssert<S,A>
org.fest.assertions.ObjectGroupAssert<ObjectArrayAssert,Object[]>
org.fest.assertions.ObjectArrayAssert
public class ObjectArrayAssert
Assertions for Object arrays.
To create a new instance of this class invoke .
Assertions.assertThat(Object[])
| Field Summary |
|---|
| Fields inherited from class org.fest.assertions.GenericAssert |
|---|
actual, myself |
| Constructor Summary | |
|---|---|
protected |
ObjectArrayAssert(Object... actual)
Creates a new ObjectArrayAssert. |
| Method Summary | |
|---|---|
protected List<Object> |
actualAsList()
Returns the actual value as a List. |
protected Set<Object> |
actualAsSet()
Returns the actual value as a Set. |
protected int |
actualGroupSize()
Returns the size of the actual group of values (array, collection, etc.) |
ObjectArrayAssert |
hasAllElementsOfType(Class<?> type)
Verifies that all the elements in the actual Object array belong to the specified type. |
ObjectArrayAssert |
hasAtLeastOneElementOfType(Class<?> type)
Verifies that at least one element in the actual Object array belong to the specified type. |
ObjectArrayAssert |
isEqualTo(Object[] expected)
Verifies that the actual Object array is equal to the given array. |
ObjectArrayAssert |
isNotEqualTo(Object[] array)
Verifies that the actual Object array is not equal to the given array. |
ObjectArrayAssert |
onProperty(String propertyName)
Creates a new instance of whose target array contains the values of the
given property name from the elements of this ObjectArrayAssert's array. |
| Methods inherited from class org.fest.assertions.ObjectGroupAssert |
|---|
contains, containsOnly, doesNotHaveDuplicates, excludes |
| Methods inherited from class org.fest.assertions.ItemGroupAssert |
|---|
assertContains, assertContainsOnly, assertDoesNotHaveDuplicates, assertExcludes, validateIsNotNull |
| Methods inherited from class org.fest.assertions.GroupAssert |
|---|
hasSize, isEmpty, isNotEmpty, isNullOrEmpty |
| Methods inherited from class org.fest.assertions.GenericAssert |
|---|
as, as, describedAs, describedAs, doesNotSatisfy, is, isIn, isIn, isNot, isNotIn, isNotIn, isNotNull, isNotSameAs, isNull, isSameAs, overridingErrorMessage, satisfies |
| Methods inherited from class org.fest.assertions.Assert |
|---|
customErrorMessage, description, description, description, equals, fail, fail, failIfCustomMessageIsSet, failIfCustomMessageIsSet, failure, formattedErrorMessage, hashCode, rawDescription, replaceDefaultErrorMessagesWith |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected ObjectArrayAssert(Object... actual)
ObjectArrayAssert.
actual - the target to verify.| Method Detail |
|---|
public ObjectArrayAssert hasAllElementsOfType(Class<?> type)
Object array belong to the specified type. Matching
includes subclasses of the given type.
For example, consider the following code listing:
Number[] numbers = { 2, 6 ,8 };
assertThat(numbers).hasComponentType(Integer.class);
The assertion hasAllElementsOfType will be successful.
type - the expected type.
NullPointerException - if the given type is null.
AssertionError - if the component type of the actual Object array is not the same as the
specified one.public ObjectArrayAssert hasAtLeastOneElementOfType(Class<?> type)
Object array belong to the specified type. Matching
includes subclasses of the given type.
type - the expected type.
AssertionError - if the actual Object does not have any elements of the given type.public ObjectArrayAssert isEqualTo(Object[] expected)
Object array is equal to the given array. Array equality is checked by
Arrays.deepEquals(Object[], Object[]).
isEqualTo in class GenericAssert<ObjectArrayAssert,Object[]>expected - the given array to compare the actual array to.
AssertionError - if the actual Object array is not equal to the given one.public ObjectArrayAssert isNotEqualTo(Object[] array)
Object array is not equal to the given array. Array equality is checked by
Arrays.deepEquals(Object[], Object[]).
isNotEqualTo in class GenericAssert<ObjectArrayAssert,Object[]>array - the given array to compare the actual array to.
AssertionError - if the actual Object array is equal to the given one.public ObjectArrayAssert onProperty(String propertyName)
ObjectArrayAssert whose target array contains the values of the
given property name from the elements of this ObjectArrayAssert's array. Property access works with both
simple properties like Person.age and nested properties Person.father.age.
For example, let's say we have a array of Person objects and you want to verify their age:
assertThat(persons).onProperty("age").containsOnly(25, 16, 44, 37); // simple property
assertThat(persons).onProperty("father.age").containsOnly(55, 46, 74, 62); // nested property
onProperty in class ObjectGroupAssert<ObjectArrayAssert,Object[]>propertyName - the name of the property to extract values from the actual array to build a new
ObjectArrayAssert.
ObjectArrayAssert containing the values of the given property name from the elements of this
ObjectArrayAssert's array.
AssertionError - if the actual array is null.
org.fest.util.IntrospectionError - if an element in the given array does not have a matching property.protected Set<Object> actualAsSet()
Set.
actualAsSet in class ItemGroupAssert<ObjectArrayAssert,Object[]>Set.protected List<Object> actualAsList()
List.
actualAsList in class ItemGroupAssert<ObjectArrayAssert,Object[]>List.protected int actualGroupSize()
actualGroupSize in class GroupAssert<ObjectArrayAssert,Object[]>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||