org.hamcrest.object
Class IsEventFrom

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

public class IsEventFrom
extends TypeSafeDiagnosingMatcher<EventObject>

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


Constructor Summary
IsEventFrom(Class<?> eventClass, Object source)
           
 
Method Summary
 void describeTo(Description description)
          Generates a description of the object.
static Matcher<EventObject> eventFrom(Class<? extends EventObject> eventClass, Object source)
          Constructs an IsEventFrom Matcher that returns true for any object derived from eventClass announced by source.
static Matcher<EventObject> eventFrom(Object source)
          Constructs an IsEventFrom Matcher that returns true for any object derived from EventObject announced by source .
 boolean matchesSafely(EventObject item, Description mismatchDescription)
          Subclasses should implement this.
 
Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, 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(Class<?> eventClass,
                   Object source)
Method Detail

matchesSafely

public boolean matchesSafely(EventObject item,
                             Description mismatchDescription)
Description copied from class: TypeSafeDiagnosingMatcher
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 TypeSafeDiagnosingMatcher<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<EventObject> eventFrom(Class<? extends EventObject> eventClass,
                                             Object source)
Constructs an IsEventFrom Matcher that returns true for any object derived from eventClass announced by source.


eventFrom

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