org.hamcrest.object
Class IsEventFrom

java.lang.Object
  extended by org.hamcrest.BaseMatcher<T>
      extended by org.hamcrest.TypeSafeMatcher<java.util.EventObject>
          extended by org.hamcrest.object.IsEventFrom
All Implemented Interfaces:
Matcher<java.util.EventObject>, SelfDescribing

public class IsEventFrom
extends TypeSafeMatcher<java.util.EventObject>

Tests if the value is an event announced by a specific object.


Constructor Summary
IsEventFrom(java.lang.Class eventClass, java.lang.Object source)
           
 
Method Summary
 void describeTo(Description description)
          Generates a description of the object.
static Matcher<java.util.EventObject> eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass, java.lang.Object source)
          Constructs an IsEventFrom Matcher that returns true for any object derived from eventClass announced by source.
static Matcher<java.util.EventObject> eventFrom(java.lang.Object source)
          Constructs an IsEventFrom Matcher that returns true for any object derived from EventObject announced by source .
 boolean matchesSafely(java.util.EventObject item)
          Subclasses should implement this.
 
Methods inherited from class org.hamcrest.TypeSafeMatcher
matches
 
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IsEventFrom

public IsEventFrom(java.lang.Class eventClass,
                   java.lang.Object source)
Method Detail

matchesSafely

public boolean matchesSafely(java.util.EventObject item)
Description copied from class: TypeSafeMatcher
Subclasses should implement this. The item will already have been checked for the specific type and will never be null.

Specified by:
matchesSafely in class TypeSafeMatcher<java.util.EventObject>

describeTo

public void describeTo(Description description)
Description copied from interface: SelfDescribing
Generates a description of the object. The description may be part of a a description of a larger object of which this is just a component, so it should be worded appropriately.

Parameters:
description - The description to be built or appended to.

eventFrom

public static Matcher<java.util.EventObject> eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass,
                                                       java.lang.Object source)
Constructs an IsEventFrom Matcher that returns true for any object derived from eventClass announced by source.


eventFrom

public static Matcher<java.util.EventObject> eventFrom(java.lang.Object source)
Constructs an IsEventFrom Matcher that returns true for any object derived from EventObject announced by source .