jaggregate.junit.framework
Class ObjectAssert

java.lang.Object
  extended by jaggregate.junit.framework.ObjectAssert

public class ObjectAssert
extends Object

Additional assertions for JUnit that apply to Java objects in general.

Version:
$Id: ObjectAssert.java,v 1.5 2008/05/08 03:49:38 pholser Exp $
Author:
Paul Holser

Method Summary
static
<T> void
assertMatches(T target, UnaryCondition<? super T> constraint)
          Asserts that a given object satisfies a given constraint.
static
<T> void
assertThat(T target, UnaryPredicate<? super T> constraint)
          Asserts that a given object satisfies a given constraint.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

assertThat

public static <T> void assertThat(T target,
                                  UnaryPredicate<? super T> constraint)
Asserts that a given object satisfies a given constraint.

Type Parameters:
T - a restriction on the type of the target object
Parameters:
target - the object to query
constraint - the constraint that target must satisfy
Throws:
AssertionFailedError - if the constraint is not satisfied
See Also:
Flexible JUnit assertions with assertThat()

assertMatches

public static <T> void assertMatches(T target,
                                     UnaryCondition<? super T> constraint)
Asserts that a given object satisfies a given constraint.

Type Parameters:
T - a restriction on the type of the target object
Parameters:
target - the object to query
constraint - the constraint that target must satisfy
Throws:
AssertionFailedError - if the constraint is not satisfied
See Also:
Flexible JUnit assertions with assertThat()


© Copyright 2004-2008 Paul R. Holser, Jr. All rights reserved. Licensed under the Academic Free License version 3.0. pholser@alumni.rice.edu