Top Description Constructors Methods
org.hamcrest

public abstract Class BaseMatcher<T>

extends Object
implements Matcher<T>
Class Inheritance
All Implemented Interfaces
org.hamcrest.Matcher, org.hamcrest.SelfDescribing
Known Direct Subclasses
org.hamcrest.CustomMatcher, org.hamcrest.DiagnosingMatcher, org.hamcrest.TypeSafeDiagnosingMatcher, org.hamcrest.TypeSafeMatcher, org.hamcrest.collection.IsIn, org.hamcrest.core.DescribedAs, org.hamcrest.core.Is, org.hamcrest.core.IsAnything, org.hamcrest.core.IsEqual, org.hamcrest.core.IsNot, org.hamcrest.core.IsNull, org.hamcrest.core.IsSame, org.hamcrest.core.ShortcutCombination

BaseClass for all Matcher implementations.
See Also
Matcher

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final void
_dont_implement_Matcher___instead_extend_BaseMatcher_()

Implements org.hamcrest.Matcher._dont_implement_Matcher___instead_extend_BaseMatcher_.

Deprecated
This method simply acts a friendly reminder not to implement Matcher directly and instead extend BaseMatcher.
public void
describeMismatch(Object
The item that the Matcher has rejected.
item
,
Description
The description to be built or appended to.
description
)

Implements org.hamcrest.Matcher.describeMismatch.

Generate a description of why the matcher has not accepted the item.
protected static boolean

Returns:

false iff the actual object is null
isNotNull
(Object
the object to check
actual
,
Description
where to write the mismatch description, if any
mismatch
)

Useful null-check method.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Constructor Detail

BaseMatcherback to summary
public BaseMatcher()

Method Detail

_dont_implement_Matcher___instead_extend_BaseMatcher_back to summary
public final void _dont_implement_Matcher___instead_extend_BaseMatcher_()

Implements org.hamcrest.Matcher._dont_implement_Matcher___instead_extend_BaseMatcher_.

Doc from org.hamcrest.Matcher._dont_implement_Matcher___instead_extend_BaseMatcher_.

Deprecated

This method simply acts a friendly reminder not to implement Matcher directly and instead extend BaseMatcher. It's easy to ignore JavaDoc, but a bit harder to ignore compile errors .

Annotations
@Override
@Deprecated
See Also
Matcher#_dont_implement_Matcher___instead_extend_BaseMatcher_()
describeMismatchback to summary
public void describeMismatch(Object item, Description description)

Implements org.hamcrest.Matcher.describeMismatch.

Doc from org.hamcrest.Matcher.describeMismatch.

Generate a description of why the matcher has not accepted the item. The description will be part of a larger description of why a matching failed, so it should be concise. This method assumes that matches(item) is false, but will not check this.

Parameters
item:Object

The item that the Matcher has rejected.

description:Description

The description to be built or appended to.

Annotations
@Override
isNotNullback to summary
protected static boolean isNotNull(Object actual, Description mismatch)

Useful null-check method. Writes a mismatch description if the actual object is null

Parameters
actual:Object

the object to check

mismatch:Description

where to write the mismatch description, if any

Returns:boolean

false iff the actual object is null

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override