|
||||||||||
| 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<S,A>
S - used to simulate "self types." For more information please read "Emulating 'self types' using Java Generics to simplify fluent API implementation."A - the type the "actual" value.public abstract class ObjectGroupAssert<S,A>
Template for assertions for arrays or collections.
| Field Summary |
|---|
| Fields inherited from class org.fest.assertions.GenericAssert |
|---|
actual, myself |
| Constructor Summary | |
|---|---|
protected |
ObjectGroupAssert(Class<S> selfType,
A actual)
Creates a new ObjectGroupAssert. |
| Method Summary | |
|---|---|
S |
contains(Object... objects)
Verifies that the actual group of objects contains the given objects. |
S |
containsOnly(Object... objects)
Verifies that the actual group of objects contains the given objects only, in any order. |
S |
doesNotHaveDuplicates()
Verifies that the actual group of objects does not have duplicates. |
S |
excludes(Object... objects)
Verifies that the actual group of objects does not contain the given objects. |
protected abstract S |
onProperty(String propertyName)
Creates a new group of objects whose target collection contains the values of the given property name from the elements of the actual group of objects. |
| Methods inherited from class org.fest.assertions.ItemGroupAssert |
|---|
actualAsList, actualAsSet, assertContains, assertContainsOnly, assertDoesNotHaveDuplicates, assertExcludes, validateIsNotNull |
| Methods inherited from class org.fest.assertions.GroupAssert |
|---|
actualGroupSize, hasSize, isEmpty, isNotEmpty, isNullOrEmpty |
| Methods inherited from class org.fest.assertions.GenericAssert |
|---|
as, as, describedAs, describedAs, doesNotSatisfy, is, isEqualTo, isIn, isIn, isNot, isNotEqualTo, 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 ObjectGroupAssert(Class<S> selfType,
A actual)
ObjectGroupAssert.
selfType - the "self type."actual - the target to verify.| Method Detail |
|---|
public final S contains(Object... objects)
objects - the objects to look for.
AssertionError - if the actual group of objects is null.
NullPointerException - if the given array is null.
AssertionError - if the actual group of objects does not contain the given objects.public final S containsOnly(Object... objects)
objects - the objects to look for.
AssertionError - if the actual group of objects is null.
NullPointerException - if the given group of objects is null.
AssertionError - if the actual group of objects does not contain the given objects, or if the actual group of
objects contains elements other than the ones specified.public final S excludes(Object... objects)
objects - the objects that the group of objects should exclude.
AssertionError - if the actual group of objects is null.
NullPointerException - if the given array is null.
AssertionError - if the actual group of objects contains any of the given objects.public final S doesNotHaveDuplicates()
AssertionError - if the actual group of objects is null.
AssertionError - if the actual group of objects has duplicates.protected abstract S onProperty(String propertyName)
Person.age
and nested properties Person.father.age.
For example, let's say we have a collection 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
propertyName - the name of the property to extract values from the actual collection to build a new group of
objects.
AssertionError - if the actual group of objects is null.
org.fest.util.IntrospectionError - if an element in the given collection does not have a matching property.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||