se.mockachino.matchers
Class MatchersBase

java.lang.Object
  extended by se.mockachino.matchers.MatchersBase
Direct Known Subclasses:
Matchers

public class MatchersBase
extends java.lang.Object

This class contain a lot of built in matchers.


Constructor Summary
MatchersBase()
           
 
Method Summary
static
<T> Matcher<T>
mAnd(Matcher<T>... matchers)
          Return a new matcher that matches if all the given matchers match
static
<T> Matcher<T>
mAny(java.lang.Class<T> clazz)
          Return a new matcher that always matches.
static Matcher<java.lang.Boolean> mAnyBoolean()
          Return a new matcher that always matches.
static Matcher<java.lang.Byte> mAnyByte()
          Return a new matcher that always matches.
static Matcher<java.lang.Character> mAnyChar()
          Return a new matcher that always matches.
static Matcher<java.lang.Double> mAnyDouble()
          Return a new matcher that always matches.
static Matcher<java.lang.Float> mAnyFloat()
          Return a new matcher that always matches.
static Matcher<java.lang.Integer> mAnyInt()
          Return a new matcher that always matches.
static Matcher<java.lang.Long> mAnyLong()
          Return a new matcher that always matches.
static Matcher<java.lang.Short> mAnyShort()
          Return a new matcher that always matches.
static
<T> Matcher<T>
matchEq(T value, java.lang.Class<T> clazz)
           
static Matcher<java.lang.String> mContains(java.lang.String s)
          Return a new matcher that matches if the argument contains s.
static Matcher<java.lang.String> mEndsWith(java.lang.String s)
          Return a new matcher that matches if the argument ends with s.
static
<T> Matcher<T>
mEq(T value)
          Returns a new matcher that compares the value with the actual parameter based on equality.
static
<T> Matcher<T>
mNot(Matcher<T> matcher)
          Return a new matcher that's the negation of the specified matcher.
static
<T> Matcher<T>
mOr(Matcher<T>... matchers)
          Return a new matcher that matches if any of the given matchers match
static Matcher<java.lang.String> mRegexp(java.lang.String s)
          Return a new matcher that matches against a regular expression
static
<T> Matcher<T>
mSame(T value)
          Returns a new matcher that compares the identity of the value with the actual parameter
static Matcher<java.lang.String> mStartsWith(java.lang.String s)
          Return a new matcher that matches if the argument starts with s.
static
<T> Matcher<T>
mType(java.lang.Class<T> clazz, java.lang.Class<?>... classes)
          Return a new matcher that matches if the argument is an instance of any of the classes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MatchersBase

public MatchersBase()
Method Detail

mNot

public static <T> Matcher<T> mNot(Matcher<T> matcher)
Return a new matcher that's the negation of the specified matcher.

Parameters:
matcher -
Returns:
a new matcher

mAnd

public static <T> Matcher<T> mAnd(Matcher<T>... matchers)
Return a new matcher that matches if all the given matchers match

Parameters:
matchers -
Returns:
a new matcher

mOr

public static <T> Matcher<T> mOr(Matcher<T>... matchers)
Return a new matcher that matches if any of the given matchers match

Parameters:
matchers -
Returns:
a new matcher

mType

public static <T> Matcher<T> mType(java.lang.Class<T> clazz,
                                   java.lang.Class<?>... classes)
Return a new matcher that matches if the argument is an instance of any of the classes.

Returns:
a new matcher

mEq

public static <T> Matcher<T> mEq(T value)
Returns a new matcher that compares the value with the actual parameter based on equality. For primitive arrays, it compares based in array content, instead of array identity. This is also recursive, so it handles values such as int[][], et.c.

Parameters:
value -
Returns:
a new matcher

matchEq

public static <T> Matcher<T> matchEq(T value,
                                     java.lang.Class<T> clazz)

mSame

public static <T> Matcher<T> mSame(T value)
Returns a new matcher that compares the identity of the value with the actual parameter

Parameters:
value -
Returns:
a new matcher

mAny

public static <T> Matcher<T> mAny(java.lang.Class<T> clazz)
Return a new matcher that always matches.

Parameters:
clazz - - the return type
Returns:
a new matcher

mAnyInt

public static Matcher<java.lang.Integer> mAnyInt()
Return a new matcher that always matches.

Returns:
a new matcher

mAnyLong

public static Matcher<java.lang.Long> mAnyLong()
Return a new matcher that always matches.

Returns:
a new matcher

mAnyDouble

public static Matcher<java.lang.Double> mAnyDouble()
Return a new matcher that always matches.

Returns:
a new matcher

mAnyFloat

public static Matcher<java.lang.Float> mAnyFloat()
Return a new matcher that always matches.

Returns:
a new matcher

mAnyShort

public static Matcher<java.lang.Short> mAnyShort()
Return a new matcher that always matches.

Returns:
a new matcher

mAnyByte

public static Matcher<java.lang.Byte> mAnyByte()
Return a new matcher that always matches.

Returns:
a new matcher

mAnyBoolean

public static Matcher<java.lang.Boolean> mAnyBoolean()
Return a new matcher that always matches.

Returns:
a new matcher

mAnyChar

public static Matcher<java.lang.Character> mAnyChar()
Return a new matcher that always matches.

Returns:
a new matcher

mRegexp

public static Matcher<java.lang.String> mRegexp(java.lang.String s)
Return a new matcher that matches against a regular expression

Parameters:
s -
Returns:
a new matcher

mContains

public static Matcher<java.lang.String> mContains(java.lang.String s)
Return a new matcher that matches if the argument contains s.

Parameters:
s -
Returns:
a new matcher

mStartsWith

public static Matcher<java.lang.String> mStartsWith(java.lang.String s)
Return a new matcher that matches if the argument starts with s.

Parameters:
s -
Returns:
a new matcher

mEndsWith

public static Matcher<java.lang.String> mEndsWith(java.lang.String s)
Return a new matcher that matches if the argument ends with s.

Parameters:
s -
Returns:
a new matcher