public final class

EasyMockMatcherUtils

extends Object
java.lang.Object
   ↳ com.atlassian.jira.easymock.EasyMockMatcherUtils

Class Overview

Static utilities for easier creation of org.easymock.classextension.EasyMock matchers.

Summary

Public Methods
static <T> T any(Class<T> argumentType)

Typed 'any' matcher.

static <E> Collection<E> anyCollection(Class<E> elementType)

Typed 'any collection' matcher.

static <E> List<E> anyList(Class<E> elementType)

Typed 'any list' matcher.

static <K, V> Map<K, V> anyMap(Class<K> keyType, Class<V> valueType)

Typed 'any map' matcher.

static String anyString()
Shortcut for any(Class) called with String class.
static <K, V> Map<K, V> mapContaining(K key1, V value1, K key2, V value2)
Matcher for a map containing at least two entries specified by given keys and values
static <K, V> Map<K, V> mapContaining(K key, V value)
Matcher for a map containing given key and value.
static <T> T nullArg(Class<T> argumentType)
Typed 'is null' matcher.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static T any (Class<T> argumentType)

Typed 'any' matcher.

WARNING this is just syntactic sugar, it is different than isA(Class) in that it does not check type of the actual argument.

Parameters
argumentType class representing argument's type
Returns
  • typed 'any' EasyMock matcher

public static Collection<E> anyCollection (Class<E> elementType)

Typed 'any collection' matcher.

This is equivalent to isA(Class), with a Collection parameter, but avoids type-safety warnings in the calling methods.

Parameters
elementType class representing the type of list elements
Returns
  • typed 'is any collection' EasyMock matcher

public static List<E> anyList (Class<E> elementType)

Typed 'any list' matcher.

This is equivalent to isA(Class) with a List parameter, but avoids type-safety warnings in the calling methods.

Parameters
elementType class representing the type of list elements
Returns
  • typed 'is any list' EasyMock matcher

public static Map<K, V> anyMap (Class<K> keyType, Class<V> valueType)

Typed 'any map' matcher.

This is equivalent to isA(Class)} with a Map parameter, but avoids type-safety warnings in the calling methods.

Parameters
keyType class representing the type of map keys
valueType class representing the type of map values
Returns
  • typed 'is any map' EasyMock matcher

public static String anyString ()

Shortcut for any(Class) called with String class.

Returns
  • typed 'any string' EasyMock matcher
See Also

public static Map<K, V> mapContaining (K key1, V value1, K key2, V value2)

Matcher for a map containing at least two entries specified by given keys and values

Parameters
key1 first key
value1 first value
key2 second key
value2 second value
Returns
  • map containing matcher

public static Map<K, V> mapContaining (K key, V value)

Matcher for a map containing given key and value.

Parameters
key key
value value
Returns
  • map containing matcher

public static T nullArg (Class<T> argumentType)

Typed 'is null' matcher.

Parameters
argumentType class representing argument's type
Returns
  • typed 'is null' EasyMock matcher