org.fest.assertions
Class GroupAssert<S,A>

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>
Type Parameters:
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.
Direct Known Subclasses:
ItemGroupAssert, MapAssert, StringAssert

public abstract class GroupAssert<S,A>
extends GenericAssert<S,A>

Template for assertions for classes representing groups of values.

Author:
Yvonne Wang, Alex Ruiz

Field Summary
 
Fields inherited from class org.fest.assertions.GenericAssert
actual, myself
 
Constructor Summary
protected GroupAssert(Class<S> selfType, A actual)
          Creates a new GroupAssert.
 
Method Summary
protected abstract  int actualGroupSize()
          Returns the size of the actual group of values (array, collection, etc.)
 S hasSize(int expected)
          Verifies that the number of values in the actual group is equal to the given one.
 void isEmpty()
          Verifies that the actual group of values is empty.
 S isNotEmpty()
          Verifies that the actual group contains at least on value.
 void isNullOrEmpty()
          Verifies that the actual group of values is null or empty.
 
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

GroupAssert

protected GroupAssert(Class<S> selfType,
                      A actual)
Creates a new GroupAssert.

Parameters:
selfType - the "self type."
actual - the target to verify.
Method Detail

isNullOrEmpty

public final void isNullOrEmpty()
Verifies that the actual group of values is null or empty.

Throws:
AssertionError - if the actual group of values is not null or not empty.

isEmpty

public final void isEmpty()
Verifies that the actual group of values is empty.

Throws:
AssertionError - if the actual group of values is null or not empty.

isNotEmpty

public final S isNotEmpty()
Verifies that the actual group contains at least on value.

Returns:
this assertion object.
Throws:
AssertionError - if the actual group is null or empty.

hasSize

public final S hasSize(int expected)
Verifies that the number of values in the actual group is equal to the given one.

Parameters:
expected - the expected number of values in the actual group.
Returns:
this assertion object.
Throws:
AssertionError - if the number of values of the actual group is not equal to the given one.

actualGroupSize

protected abstract int actualGroupSize()
Returns the size of the actual group of values (array, collection, etc.)

Returns:
the size of the actual group of values.


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