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> extends ItemGroupAssert<S,A>
actual, myself| Modifier | Constructor and Description |
|---|---|
protected |
ObjectGroupAssert(Class<S> selfType,
A actual)
Creates a new
ObjectGroupAssert. |
| Modifier and Type | Method and Description |
|---|---|
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.
|
actualAsList, actualAsSet, assertContains, assertContainsOnly, assertDoesNotHaveDuplicates, assertExcludes, validateIsNotNullactualGroupSize, hasSize, isEmpty, isNotEmpty, isNullOrEmptyas, as, describedAs, describedAs, doesNotSatisfy, is, isEqualTo, isIn, isIn, isNot, isNotEqualTo, isNotIn, isNotIn, isNotNull, isNotSameAs, isNull, isSameAs, overridingErrorMessage, satisfiescustomErrorMessage, description, description, description, equals, fail, fail, failIfCustomMessageIsSet, failIfCustomMessageIsSet, failure, formattedErrorMessage, hashCode, rawDescription, replaceDefaultErrorMessagesWithprotected ObjectGroupAssert(Class<S> selfType, A actual)
ObjectGroupAssert.selfType - the "self type."actual - the target to verify.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.Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.