org.rhq.test
Class AssertUtils

java.lang.Object
  extended by org.rhq.test.AssertUtils

public class AssertUtils
extends Object


Constructor Summary
AssertUtils()
           
 
Method Summary
static
<T> void
assertCollectionEqualsNoOrder(Collection<T> expected, Collection<T> actual, String msg)
          Verifies that two collections are equal, according to the definition of equals() of the contained elements.
static
<T> void
assertPropertiesMatch(String msg, T expected, T actual, List<String> ignoredProperties)
          Verifies that all public, accessible properties of the two objects are equal, excluding those specified in the ignoredProperties argument.
static
<T> void
assertPropertiesMatch(String msg, T expected, T actual, String... ignoredProperties)
           
static
<T> void
assertPropertiesMatch(T expected, T actual, String msg)
          Verifies that all public, accessible properties of the two objects are equal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssertUtils

public AssertUtils()
Method Detail

assertPropertiesMatch

public static <T> void assertPropertiesMatch(T expected,
                                             T actual,
                                             String msg)
Verifies that all public, accessible properties of the two objects are equal. This method might be used when you want to compare two objects without using their equals() methods or when they do not implement equals().

Type Parameters:
T - The type of the objects to be compared
Parameters:
expected - The expected object to compare against. Should be non-null.
actual - The actual object to be compared. Should be non-null.
msg - An error message

assertPropertiesMatch

public static <T> void assertPropertiesMatch(String msg,
                                             T expected,
                                             T actual,
                                             String... ignoredProperties)
Type Parameters:
T - The type of the objects to be compared.
Parameters:
msg - An error message
expected - The expected object to compare against. Should be non-null.
actual - The actual object to be compared. Should be non-null.
ignoredProperties - A list of property names to exclude from comparison.

assertPropertiesMatch

public static <T> void assertPropertiesMatch(String msg,
                                             T expected,
                                             T actual,
                                             List<String> ignoredProperties)
Verifies that all public, accessible properties of the two objects are equal, excluding those specified in the ignoredProperties argument. This method might be used when you want to compare two objects without using their equals() methods or when they do not implement equals.

Type Parameters:
T - The type of the objects to be compared.
Parameters:
msg - An error message
expected - The expected object to compare against. Should be non-null.
actual - The actual object to be compared. Should be non-null.
ignoredProperties - A list of property names to exclude from comparison.

assertCollectionEqualsNoOrder

public static <T> void assertCollectionEqualsNoOrder(Collection<T> expected,
                                                     Collection<T> actual,
                                                     String msg)
Verifies that two collections are equal, according to the definition of equals() of the contained elements. Order is ignored as well as the runtime type of the collections.

Type Parameters:
T - The type of the elements in the collections
Parameters:
expected - The expected collection to compare against
actual - The actual collection to compare against
msg - An error message


Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.