org.hamcrest.collection
Class IsMapContainingKey<K>

java.lang.Object
  extended by org.hamcrest.BaseMatcher<T>
      extended by org.hamcrest.TypeSafeMatcher<java.util.Map<? super K,?>>
          extended by org.hamcrest.collection.IsMapContainingKey<K>
All Implemented Interfaces:
Matcher<java.util.Map<? super K,?>>, SelfDescribing

public class IsMapContainingKey<K>
extends TypeSafeMatcher<java.util.Map<? super K,?>>


Constructor Summary
IsMapContainingKey(Matcher<? super K> keyMatcher)
           
 
Method Summary
 void describeMismatchSafely(java.util.Map<? super K,?> map, Description mismatchDescription)
          Subclasses should override this.
 void describeTo(Description description)
          Generates a description of the object.
static
<K> Matcher<java.util.Map<? super K,?>>
hasKey(K key)
           
static
<K> Matcher<java.util.Map<? super K,?>>
hasKey(Matcher<? super K> keyMatcher)
           
 boolean matchesSafely(java.util.Map<? super K,?> item)
          Subclasses should implement this.
 
Methods inherited from class org.hamcrest.TypeSafeMatcher
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

IsMapContainingKey

public IsMapContainingKey(Matcher<? super K> keyMatcher)
Method Detail

matchesSafely

public boolean matchesSafely(java.util.Map<? super K,?> 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.Map<? super K,?>>

describeMismatchSafely

public void describeMismatchSafely(java.util.Map<? super K,?> map,
                                   Description mismatchDescription)
Description copied from class: TypeSafeMatcher
Subclasses should override this. The item will already have been checked for the specific type and will never be null.

Overrides:
describeMismatchSafely in class TypeSafeMatcher<java.util.Map<? super K,?>>

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.

hasKey

public static <K> Matcher<java.util.Map<? super K,?>> hasKey(K key)

hasKey

public static <K> Matcher<java.util.Map<? super K,?>> hasKey(Matcher<? super K> keyMatcher)