org.jdesktop.test.matchers
Class Matchers

java.lang.Object
  extended by org.jdesktop.test.matchers.Matchers

public final class Matchers
extends Object

A collection of matchers useful for testing.

Author:
kschaefer

Constructor Summary
Matchers()
           
 
Method Summary
static org.hamcrest.Matcher<PropertyChangeEvent> anyProperty()
          A matcher for any property change.
static
<T> org.hamcrest.Matcher<T>
equivalentTo(T object)
          This matcher returns true when the arguments are equivalent.
static org.hamcrest.Matcher<PropertyChangeEvent> property(String propertyName, Object oldValue, Object newValue)
          A matcher for a specified property.
static org.hamcrest.Matcher<PropertyChangeEvent> propertyWithName(String propertyName)
          A matcher for a specified property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Matchers

public Matchers()
Method Detail

anyProperty

public static org.hamcrest.Matcher<PropertyChangeEvent> anyProperty()
A matcher for any property change.

Returns:
true if any property can be matched; false otherwise

propertyWithName

public static org.hamcrest.Matcher<PropertyChangeEvent> propertyWithName(String propertyName)
A matcher for a specified property.

Parameters:
propertyName - the name of the property to match
Returns:
true if the property exists and has a name that matches the specified name; false otherwise

property

public static org.hamcrest.Matcher<PropertyChangeEvent> property(String propertyName,
                                                                 Object oldValue,
                                                                 Object newValue)
A matcher for a specified property.

Parameters:
propertyName - the name of the property to match
oldValue - the old property value
newValue - the new property value
Returns:
true if the property exists and all parameters match the specified values; false otherwise

equivalentTo

public static <T> org.hamcrest.Matcher<T> equivalentTo(T object)
This matcher returns true when the arguments are equivalent.

For purposes of this matcher equivalence is as follows:

  1. the objects are equal
  2. the objects contain the same contents, insofar as the class info for each object instance returns equivalent values

Type Parameters:
T - the type of the matcher
Parameters:
object - the object to test
Returns:
true if the object is equivalent; false otherwise


Copyright © 2013. All Rights Reserved.