org.fest.assertions
Class IteratorAssert

java.lang.Object
  extended by org.fest.assertions.Assert
      extended by org.fest.assertions.GenericAssert<S,A>
          extended by org.fest.assertions.GroupAssert<S,A>
              extended by org.fest.assertions.ItemGroupAssert<S,A>
                  extended by org.fest.assertions.ObjectGroupAssert<IteratorAssert,Iterator<?>>
                      extended by 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

Field Summary
 
Fields inherited from class org.fest.assertions.GenericAssert
actual, myself
 
Constructor Summary
protected IteratorAssert(Iterator<?> actual)
          Creates a new IteratorAssert.
 
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.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, 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

IteratorAssert

protected IteratorAssert(Iterator<?> actual)
Creates a new IteratorAssert.

Parameters:
actual - the target to verify.
Method Detail

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.