org.fest.assertions
Class IteratorAssert
java.lang.Object
org.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<IteratorAssert,Iterator<?>>
org.fest.assertions.IteratorAssert
public class IteratorAssert
- extends ObjectGroupAssert<IteratorAssert,Iterator<?>>
Assertions for Iterators.
To create a new instance of this class invoke Assertions.assertThat(Iterator).
- Since:
- 1.4
- Author:
- Alex Ruiz
|
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.) |
protected IteratorAssert |
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.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 |
IteratorAssert
protected IteratorAssert(Iterator<?> actual)
- Creates a new
IteratorAssert.
- Parameters:
actual - the target to verify.
onProperty
protected IteratorAssert 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. Property access works with both simple properties like
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
- Specified by:
onProperty in class ObjectGroupAssert<IteratorAssert,Iterator<?>>
- Parameters:
propertyName - the name of the property to extract values from the actual collection to build a new group of
objects.
- Returns:
- a new group of objects containing the values of the given property name from the elements of the actual
group of objects.
actualAsSet
protected Set<Object> actualAsSet()
- Returns the actual value as a
Set.
- Specified by:
actualAsSet in class ItemGroupAssert<IteratorAssert,Iterator<?>>
- Returns:
- the actual value as a
Set.
actualAsList
protected List<Object> actualAsList()
- Returns the actual value as a
List.
- Specified by:
actualAsList in class ItemGroupAssert<IteratorAssert,Iterator<?>>
- Returns:
- the actual value as a
List.
actualGroupSize
protected int actualGroupSize()
- Returns the size of the actual group of values (array, collection, etc.)
- Specified by:
actualGroupSize in class GroupAssert<IteratorAssert,Iterator<?>>
- Returns:
- the size of the actual group of values.
Copyright © 2007-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.