org.apache.hivemind.test
Class TypeMatcher

java.lang.Object
  extended byorg.apache.hivemind.test.TypeMatcher
All Implemented Interfaces:
ArgumentMatcher

public class TypeMatcher
extends java.lang.Object
implements ArgumentMatcher

An ArgumentMatcherthat only compares the types of the two objects, not their actual values. This is useful for Throwable arguments, (since Throwables rarely implement a useful equals). This allows a check that the right type of exception was passed in (even if it doesn't check that the exception's message and other properties are correct).

Author:
Howard Lewis Ship

Constructor Summary
TypeMatcher()
           
 
Method Summary
 boolean matches(java.lang.Object expected, java.lang.Object actual)
          Returns true if the two objects are considered the same.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeMatcher

public TypeMatcher()
Method Detail

matches

public boolean matches(java.lang.Object expected,
                       java.lang.Object actual)
Description copied from interface: ArgumentMatcher
Returns true if the two objects are considered the same. This method is only invoked if both arguments are non-null and not the same object (identity comparison, not equals()).

Specified by:
matches in interface ArgumentMatcher
Parameters:
expected - The expected argument value
actual - The actual argument value