org.fest.assertions
Class ItemGroupAssert<T>

java.lang.Object
  extended by org.fest.assertions.Assert
      extended by org.fest.assertions.GenericAssert<T>
          extended by org.fest.assertions.GroupAssert<T>
              extended by org.fest.assertions.ItemGroupAssert<T>
Type Parameters:
T - the type of object implementations of this template can verify.
Direct Known Subclasses:
ArrayAssert, ObjectGroupAssert

public abstract class ItemGroupAssert<T>
extends GroupAssert<T>

Understands a template for assertion methods related to groups of items (e.g. collections or arrays.)

Since:
1.3
Author:
Yvonne Wang

Field Summary
 
Fields inherited from class org.fest.assertions.GenericAssert
actual
 
Constructor Summary
ItemGroupAssert(T actual)
          Creates a new ItemGroupAssert.
 
Method Summary
protected abstract  List<Object> actualAsList()
          Returns the actual value as a List.
protected abstract  Set<Object> actualAsSet()
          Returns the actual value as a Set.
protected  void assertContains(Object... objects)
          Verifies that the actual actual group of objects contains the given objects, in any order.
protected  void assertContainsOnly(Object... objects)
          Verifies that the actual group of objects contains the given objects only, in any order.
protected  void assertDoesNotHaveDuplicates()
          Verifies that the actual group of objects does not have duplicates.
protected  void assertExcludes(Object... objects)
          Verifies that the actual group of objects does not contain the given objects.
protected static Set<Object> asSet(Object[] objects)
          Returns a set containing all the elements in the given array.
protected  void validateIsNotNull(Object[] objects)
          Validates that the given array of objects is not null.
 
Methods inherited from class org.fest.assertions.GroupAssert
actualGroupSize, as, as, assertHasSize, assertIsNotEmpty, describedAs, describedAs, hasSize, isEmpty, isNotEmpty, isNullOrEmpty, overridingErrorMessage
 
Methods inherited from class org.fest.assertions.GenericAssert
assertDoesNotSatisfy, assertEqualTo, assertIs, assertIsNot, assertNotEqualTo, assertNotNull, assertNotSameAs, assertSameAs, assertSatisfies, doesNotSatisfy, is, isEqualTo, isNot, isNotEqualTo, isNotNull, isNotSameAs, isNull, isSameAs, 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

ItemGroupAssert

public ItemGroupAssert(T actual)
Creates a new ItemGroupAssert.

Parameters:
actual -
Method Detail

assertContains

protected final void assertContains(Object... objects)
Verifies that the actual actual group of objects contains the given objects, in any order.

Parameters:
objects - the objects to look for.
Throws:
AssertionError - if the actual actual group of objects is null.
NullPointerException - if the given array is null.
AssertionError - if the actual actual group of objects does not contain the given objects.

assertContainsOnly

protected final void assertContainsOnly(Object... objects)
Verifies that the actual group of objects contains the given objects only, in any order.

Parameters:
objects - the objects to look for.
Throws:
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.

actualAsSet

protected abstract Set<Object> actualAsSet()
Returns the actual value as a Set.

Returns:
the actual value as a Set.

asSet

protected static Set<Object> asSet(Object[] objects)
Returns a set containing all the elements in the given array.

Parameters:
objects - the given array.
Returns:
a set containing all the elements in the given array.

assertExcludes

protected final void assertExcludes(Object... objects)
Verifies that the actual group of objects does not contain the given objects.

Parameters:
objects - the objects that the group of objects should exclude.
Throws:
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.

validateIsNotNull

protected final void validateIsNotNull(Object[] objects)
Validates that the given array of objects is not null.

Parameters:
objects - the array of objects to verify.
Throws:
NullPointerException - if the given array of objects is null.

assertDoesNotHaveDuplicates

protected final void assertDoesNotHaveDuplicates()
Verifies that the actual group of objects does not have duplicates.

Throws:
AssertionError - if the actual group of objects is null.
AssertionError - if the actual group of objects has duplicates.

actualAsList

protected abstract List<Object> actualAsList()
Returns the actual value as a List.

Returns:
the actual value as a List.


Copyright © 2007-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.