public class SerializableMatchers
extends java.lang.Object
implements java.io.Serializable
SerializableMatcher
instances.
Most matchers are wrappers for hamcrest's Matchers
. Please be familiar with the
documentation there. Values retained by a SerializableMatcher
are required to be
serializable, either via Java serialization or via a provided Coder
.
The following matchers are novel to Apache Beam:
kvWithKey(K)
for matching just the key of a KV
.
kvWithValue(V)
for matching just the value of a KV
.
kv(org.apache.beam.sdk.testing.SerializableMatcher<? super K>, org.apache.beam.sdk.testing.SerializableMatcher<? super V>)
for matching the key and value of a KV
.
For example, to match a group from GroupByKey
, which
has type KV<K, Iterable<V>>
for some K
and V
and where the order of the
iterable is undefined, use a matcher like kv(equalTo("some key"), containsInAnyOrder(1, 2,
3))
.
Modifier and Type | Class and Description |
---|---|
static interface |
SerializableMatchers.SerializableSupplier<T>
Supplies values of type
T , and is serializable. |
Modifier and Type | Method and Description |
---|---|
static <T> SerializableMatcher<T> |
allOf(java.lang.Iterable<SerializableMatcher<? super T>> serializableMatchers)
A
SerializableMatcher with identical criteria to Matchers.allOf(Iterable) . |
static <T> SerializableMatcher<T> |
allOf(SerializableMatcher<T>... matchers)
A
SerializableMatcher with identical criteria to Matchers.allOf(Matcher[]) . |
static <T> SerializableMatcher<T> |
anyOf(java.lang.Iterable<SerializableMatcher<? super T>> serializableMatchers)
A
SerializableMatcher with identical criteria to Matchers.anyOf(Iterable) . |
static <T> SerializableMatcher<T> |
anyOf(SerializableMatcher<T>... matchers)
A
SerializableMatcher with identical criteria to Matchers.anyOf(Matcher[]) . |
static SerializableMatcher<java.lang.Object> |
anything()
A
SerializableMatcher with identical criteria to Matchers.anything() . |
static <T> SerializableMatcher<T[]> |
arrayContaining(Coder<T> coder,
T... items)
A
SerializableMatcher with identical criteria to Matchers.arrayContaining(Object[]) . |
static <T> SerializableMatcher<T[]> |
arrayContaining(java.util.List<SerializableMatcher<? super T>> serializableMatchers)
A
SerializableMatcher with identical criteria to Matchers.arrayContaining(List) . |
static <T> SerializableMatcher<T[]> |
arrayContaining(SerializableMatcher<? super T>... matchers)
A
SerializableMatcher with identical criteria to Matchers.arrayContaining(Matcher[]) . |
static <T extends java.io.Serializable> |
arrayContaining(T... items)
A
SerializableMatcher with identical criteria to Matchers.arrayContaining(Object[]) . |
static <T> SerializableMatcher<T[]> |
arrayContainingInAnyOrder(Coder<T> coder,
T... items)
A
SerializableMatcher with identical criteria to Matchers.arrayContainingInAnyOrder(Object[]) . |
static <T> SerializableMatcher<T[]> |
arrayContainingInAnyOrder(java.util.Collection<SerializableMatcher<? super T>> serializableMatchers)
A
SerializableMatcher with identical criteria to Matchers.arrayContainingInAnyOrder(Collection) . |
static <T> SerializableMatcher<T[]> |
arrayContainingInAnyOrder(SerializableMatcher<? super T>... matchers)
A
SerializableMatcher with identical criteria to Matchers.arrayContainingInAnyOrder(Matcher[]) . |
static <T extends java.io.Serializable> |
arrayContainingInAnyOrder(T... items)
A
SerializableMatcher with identical criteria to Matchers.arrayContainingInAnyOrder(Object[]) . |
static <T> SerializableMatcher<T[]> |
arrayWithSize(int size)
A
SerializableMatcher with identical criteria to Matchers.arrayWithSize(int) . |
static <T> SerializableMatcher<T[]> |
arrayWithSize(SerializableMatcher<? super java.lang.Integer> sizeMatcher)
A
SerializableMatcher with identical criteria to Matchers.arrayWithSize(Matcher) . |
static SerializableMatcher<java.lang.Double> |
closeTo(double target,
double error)
A
SerializableMatcher with identical criteria to Matchers.closeTo(double,double) . |
static <T> SerializableMatcher<java.lang.Iterable<? extends T>> |
contains(Coder<T> coder,
T... items)
A
SerializableMatcher with identical criteria to Matchers.contains(Object[]) . |
static <T extends java.io.Serializable> |
contains(java.util.List<SerializableMatcher<? super T>> serializableMatchers)
A
SerializableMatcher with identical criteria to Matchers.contains(List) . |
static <T> SerializableMatcher<java.lang.Iterable<? extends T>> |
contains(SerializableMatcher<? super T>... matchers)
A
SerializableMatcher with identical criteria to Matchers.contains(Matcher[]) . |
static <T extends java.io.Serializable> |
contains(T... items)
A
SerializableMatcher with identical criteria to Matchers.contains(Object[]) . |
static <T> SerializableMatcher<java.lang.Iterable<? extends T>> |
containsInAnyOrder(Coder<T> coder,
T... items)
A
SerializableMatcher with identical criteria to Matchers.containsInAnyOrder(Object[]) . |
static <T> SerializableMatcher<java.lang.Iterable<? extends T>> |
containsInAnyOrder(java.util.Collection<SerializableMatcher<? super T>> serializableMatchers)
A
SerializableMatcher with identical criteria to Matchers.containsInAnyOrder(Collection) . |
static <T> SerializableMatcher<java.lang.Iterable<? extends T>> |
containsInAnyOrder(SerializableMatcher<? super T>... matchers)
A
SerializableMatcher with identical criteria to Matchers.containsInAnyOrder(Matcher[]) . |
static <T extends java.io.Serializable> |
containsInAnyOrder(T... items)
A
SerializableMatcher with identical criteria to Matchers.containsInAnyOrder(Object[]) . |
static SerializableMatcher<java.lang.String> |
containsString(java.lang.String substring)
A
SerializableMatcher with identical criteria to Matchers.containsString(java.lang.String) . |
static <T> SerializableMatcher<java.util.Collection<? extends T>> |
empty()
A
SerializableMatcher with identical criteria to Matchers.empty() . |
static <T> SerializableMatcher<T[]> |
emptyArray()
A
SerializableMatcher with identical criteria to Matchers.emptyArray() . |
static <T> SerializableMatcher<java.lang.Iterable<? extends T>> |
emptyIterable()
A
SerializableMatcher with identical criteria to Matchers.emptyIterable() . |
static SerializableMatcher<java.lang.String> |
endsWith(java.lang.String substring)
A
SerializableMatcher with identical criteria to Matchers.endsWith(java.lang.String) . |
static <T> SerializableMatcher<T> |
equalTo(Coder<T> coder,
T expected)
A
SerializableMatcher with identical criteria to Matchers.equalTo(Object) . |
static <T extends java.io.Serializable> |
equalTo(T expected)
A
SerializableMatcher with identical criteria to Matchers.equalTo(Object) . |
static <T> SerializableMatcher<T> |
fromSupplier(SerializableMatchers.SerializableSupplier<Matcher<T>> supplier)
Constructs a
SerializableMatcher from a non-serializable Matcher via
indirection through SerializableMatchers.SerializableSupplier . |
static <T extends java.lang.Comparable<T> & java.io.Serializable> |
greaterThan(Coder<T> coder,
T target)
A
SerializableMatcher with identical criteria to Matchers.greaterThan(Comparable) . |
static <T extends java.lang.Comparable<T> & java.io.Serializable> |
greaterThan(T target)
A
SerializableMatcher with identical criteria to Matchers.greaterThan(Comparable) . |
static <T extends java.lang.Comparable<T> & java.io.Serializable> |
greaterThanOrEqualTo(Coder<T> coder,
T target)
A
SerializableMatcher with identical criteria to Matchers.greaterThanOrEqualTo(Comparable) . |
static <T extends java.lang.Comparable<T>> |
greaterThanOrEqualTo(T target)
A
SerializableMatcher with identical criteria to Matchers.greaterThanOrEqualTo(Comparable) . |
static <T> SerializableMatcher<java.lang.Iterable<? super T>> |
hasItem(Coder<T> coder,
T target)
A
SerializableMatcher with identical criteria to Matchers.hasItem(Object) . |
static <T> SerializableMatcher<java.lang.Iterable<? super T>> |
hasItem(SerializableMatcher<? super T> matcher)
A
SerializableMatcher with identical criteria to Matchers.hasItem(Matcher) . |
static <T extends java.io.Serializable> |
hasItem(T target)
A
SerializableMatcher with identical criteria to Matchers.hasItem(Object) . |
static <T> SerializableMatcher<java.util.Collection<? extends T>> |
hasSize(int size)
A
SerializableMatcher with identical criteria to Matchers.hasSize(int) . |
static <T> SerializableMatcher<java.util.Collection<? extends T>> |
hasSize(SerializableMatcher<? super java.lang.Integer> sizeMatcher)
A
SerializableMatcher with identical criteria to Matchers.hasSize(Matcher) . |
static <T> SerializableMatcher<T> |
isIn(Coder<T> coder,
java.util.Collection<T> collection)
A
SerializableMatcher with identical criteria to Matchers.isIn(Collection) . |
static <T> SerializableMatcher<T> |
isIn(Coder<T> coder,
T[] items)
A
SerializableMatcher with identical criteria to Matchers.isIn(Object[]) . |
static <T extends java.io.Serializable> |
isIn(java.util.Collection<T> collection)
A
SerializableMatcher with identical criteria to Matchers.isIn(Collection) . |
static <T extends java.io.Serializable> |
isIn(T[] items)
A
SerializableMatcher with identical criteria to Matchers.isIn(Object[]) . |
static <T> SerializableMatcher<T> |
isOneOf(Coder<T> coder,
T... items)
A
SerializableMatcher with identical criteria to Matchers.isOneOf(T...) . |
static <T extends java.io.Serializable> |
isOneOf(T... elems)
A
SerializableMatcher with identical criteria to Matchers.isOneOf(T...) . |
static <T> SerializableMatcher<java.lang.Iterable<T>> |
iterableWithSize(int size)
A
SerializableMatcher with identical criteria to Matchers.iterableWithSize(int) . |
static <T> SerializableMatcher<java.lang.Iterable<T>> |
iterableWithSize(SerializableMatcher<? super java.lang.Integer> sizeMatcher)
A
SerializableMatcher with identical criteria to Matchers.iterableWithSize(Matcher) . |
static <K,V> SerializableMatcher<KV<? extends K,? extends V>> |
kv(SerializableMatcher<? super K> keyMatcher,
SerializableMatcher<? super V> valueMatcher)
A
SerializableMatcher that matches any KV with matching key and value. |
static <K,V> SerializableMatcher<KV<? extends K,? extends V>> |
kvWithKey(Coder<K> coder,
K key)
A
SerializableMatcher that matches any KV with the specified key. |
static <K extends java.io.Serializable,V> |
kvWithKey(K key)
A
SerializableMatcher that matches any KV with the specified key. |
static <K,V> SerializableMatcher<KV<? extends K,? extends V>> |
kvWithKey(SerializableMatcher<? super K> keyMatcher)
A
SerializableMatcher that matches any KV with matching key. |
static <K,V> SerializableMatcher<KV<? extends K,? extends V>> |
kvWithValue(Coder<V> coder,
V value)
A
SerializableMatcher that matches any KV with the specified value. |
static <K,V> SerializableMatcher<KV<? extends K,? extends V>> |
kvWithValue(SerializableMatcher<? super V> valueMatcher)
A
SerializableMatcher that matches any KV with matching value. |
static <K,V extends java.io.Serializable> |
kvWithValue(V value)
A
SerializableMatcher that matches any KV with the specified value. |
static <T extends java.lang.Comparable<T>> |
lessThan(Coder<T> coder,
T target)
A
SerializableMatcher with identical criteria to Matchers.lessThan(Comparable) . |
static <T extends java.lang.Comparable<T> & java.io.Serializable> |
lessThan(T target)
A
SerializableMatcher with identical criteria to Matchers.lessThan(Comparable) . |
static <T extends java.lang.Comparable<T>> |
lessThanOrEqualTo(Coder<T> coder,
T target)
A
SerializableMatcher with identical criteria to Matchers.lessThanOrEqualTo(Comparable) . |
static <T extends java.lang.Comparable<T> & java.io.Serializable> |
lessThanOrEqualTo(T target)
A
SerializableMatcher with identical criteria to Matchers.lessThanOrEqualTo(Comparable) . |
static <T> SerializableMatcher<T> |
not(SerializableMatcher<T> matcher)
A
SerializableMatcher with identical criteria to Matchers.not(org.hamcrest.Matcher<T>) . |
static SerializableMatcher<java.lang.Object> |
nullValue()
A
SerializableMatcher with identical criteria to Matchers.nullValue() . |
static SerializableMatcher<java.lang.String> |
startsWith(java.lang.String substring)
A
SerializableMatcher with identical criteria to Matchers.startsWith(java.lang.String) . |
public static <T> SerializableMatcher<T> allOf(java.lang.Iterable<SerializableMatcher<? super T>> serializableMatchers)
SerializableMatcher
with identical criteria to Matchers.allOf(Iterable)
.@SafeVarargs public static <T> SerializableMatcher<T> allOf(SerializableMatcher<T>... matchers)
SerializableMatcher
with identical criteria to Matchers.allOf(Matcher[])
.public static <T> SerializableMatcher<T> anyOf(java.lang.Iterable<SerializableMatcher<? super T>> serializableMatchers)
SerializableMatcher
with identical criteria to Matchers.anyOf(Iterable)
.@SafeVarargs public static <T> SerializableMatcher<T> anyOf(SerializableMatcher<T>... matchers)
SerializableMatcher
with identical criteria to Matchers.anyOf(Matcher[])
.public static SerializableMatcher<java.lang.Object> anything()
SerializableMatcher
with identical criteria to Matchers.anything()
.@SafeVarargs public static <T extends java.io.Serializable> SerializableMatcher<T[]> arrayContaining(T... items)
SerializableMatcher
with identical criteria to Matchers.arrayContaining(Object[])
.@SafeVarargs public static <T> SerializableMatcher<T[]> arrayContaining(Coder<T> coder, T... items)
SerializableMatcher
with identical criteria to Matchers.arrayContaining(Object[])
.
The items of type T
will be serialized using the provided Coder
. They are
explicitly not required or expected to be serializable via Java serialization.
@SafeVarargs public static <T> SerializableMatcher<T[]> arrayContaining(SerializableMatcher<? super T>... matchers)
SerializableMatcher
with identical criteria to Matchers.arrayContaining(Matcher[])
.public static <T> SerializableMatcher<T[]> arrayContaining(java.util.List<SerializableMatcher<? super T>> serializableMatchers)
SerializableMatcher
with identical criteria to Matchers.arrayContaining(List)
.@SafeVarargs public static <T extends java.io.Serializable> SerializableMatcher<T[]> arrayContainingInAnyOrder(T... items)
SerializableMatcher
with identical criteria to Matchers.arrayContainingInAnyOrder(Object[])
.@SafeVarargs public static <T> SerializableMatcher<T[]> arrayContainingInAnyOrder(Coder<T> coder, T... items)
SerializableMatcher
with identical criteria to Matchers.arrayContainingInAnyOrder(Object[])
.
The items of type T
will be serialized using the provided Coder
. They are
explicitly not required or expected to be serializable via Java serialization.
@SafeVarargs public static <T> SerializableMatcher<T[]> arrayContainingInAnyOrder(SerializableMatcher<? super T>... matchers)
SerializableMatcher
with identical criteria to Matchers.arrayContainingInAnyOrder(Matcher[])
.public static <T> SerializableMatcher<T[]> arrayContainingInAnyOrder(java.util.Collection<SerializableMatcher<? super T>> serializableMatchers)
SerializableMatcher
with identical criteria to Matchers.arrayContainingInAnyOrder(Collection)
.public static <T> SerializableMatcher<T[]> arrayWithSize(int size)
SerializableMatcher
with identical criteria to Matchers.arrayWithSize(int)
.public static <T> SerializableMatcher<T[]> arrayWithSize(SerializableMatcher<? super java.lang.Integer> sizeMatcher)
SerializableMatcher
with identical criteria to Matchers.arrayWithSize(Matcher)
.public static SerializableMatcher<java.lang.Double> closeTo(double target, double error)
SerializableMatcher
with identical criteria to Matchers.closeTo(double,double)
.@SafeVarargs public static <T extends java.io.Serializable> SerializableMatcher<java.lang.Iterable<? extends T>> contains(T... items)
SerializableMatcher
with identical criteria to Matchers.contains(Object[])
.@SafeVarargs public static <T> SerializableMatcher<java.lang.Iterable<? extends T>> contains(Coder<T> coder, T... items)
SerializableMatcher
with identical criteria to Matchers.contains(Object[])
.
The items of type T
will be serialized using the provided Coder
. They are
explicitly not required or expected to be serializable via Java serialization.
@SafeVarargs public static <T> SerializableMatcher<java.lang.Iterable<? extends T>> contains(SerializableMatcher<? super T>... matchers)
SerializableMatcher
with identical criteria to Matchers.contains(Matcher[])
.public static <T extends java.io.Serializable> SerializableMatcher<java.lang.Iterable<? extends T>> contains(java.util.List<SerializableMatcher<? super T>> serializableMatchers)
SerializableMatcher
with identical criteria to Matchers.contains(List)
.@SafeVarargs public static <T extends java.io.Serializable> SerializableMatcher<java.lang.Iterable<? extends T>> containsInAnyOrder(T... items)
SerializableMatcher
with identical criteria to Matchers.containsInAnyOrder(Object[])
.@SafeVarargs public static <T> SerializableMatcher<java.lang.Iterable<? extends T>> containsInAnyOrder(Coder<T> coder, T... items)
SerializableMatcher
with identical criteria to Matchers.containsInAnyOrder(Object[])
.
The items of type T
will be serialized using the provided Coder
. It is
explicitly not required or expected to be serializable via Java serialization.
@SafeVarargs public static <T> SerializableMatcher<java.lang.Iterable<? extends T>> containsInAnyOrder(SerializableMatcher<? super T>... matchers)
SerializableMatcher
with identical criteria to Matchers.containsInAnyOrder(Matcher[])
.public static <T> SerializableMatcher<java.lang.Iterable<? extends T>> containsInAnyOrder(java.util.Collection<SerializableMatcher<? super T>> serializableMatchers)
SerializableMatcher
with identical criteria to Matchers.containsInAnyOrder(Collection)
.public static SerializableMatcher<java.lang.String> containsString(java.lang.String substring)
SerializableMatcher
with identical criteria to Matchers.containsString(java.lang.String)
.public static <T> SerializableMatcher<java.util.Collection<? extends T>> empty()
SerializableMatcher
with identical criteria to Matchers.empty()
.public static <T> SerializableMatcher<T[]> emptyArray()
SerializableMatcher
with identical criteria to Matchers.emptyArray()
.public static <T> SerializableMatcher<java.lang.Iterable<? extends T>> emptyIterable()
SerializableMatcher
with identical criteria to Matchers.emptyIterable()
.public static SerializableMatcher<java.lang.String> endsWith(java.lang.String substring)
SerializableMatcher
with identical criteria to Matchers.endsWith(java.lang.String)
.public static <T extends java.io.Serializable> SerializableMatcher<T> equalTo(T expected)
SerializableMatcher
with identical criteria to Matchers.equalTo(Object)
.public static <T> SerializableMatcher<T> equalTo(Coder<T> coder, T expected)
SerializableMatcher
with identical criteria to Matchers.equalTo(Object)
.
The expected value of type T
will be serialized using the provided Coder
. It
is explicitly not required or expected to be serializable via Java serialization.
public static <T extends java.lang.Comparable<T> & java.io.Serializable> SerializableMatcher<T> greaterThan(T target)
SerializableMatcher
with identical criteria to Matchers.greaterThan(Comparable)
.public static <T extends java.lang.Comparable<T> & java.io.Serializable> SerializableMatcher<T> greaterThan(Coder<T> coder, T target)
SerializableMatcher
with identical criteria to Matchers.greaterThan(Comparable)
.
The target value of type T
will be serialized using the provided Coder
. It
is explicitly not required or expected to be serializable via Java serialization.
public static <T extends java.lang.Comparable<T>> SerializableMatcher<T> greaterThanOrEqualTo(T target)
SerializableMatcher
with identical criteria to Matchers.greaterThanOrEqualTo(Comparable)
.public static <T extends java.lang.Comparable<T> & java.io.Serializable> SerializableMatcher<T> greaterThanOrEqualTo(Coder<T> coder, T target)
SerializableMatcher
with identical criteria to Matchers.greaterThanOrEqualTo(Comparable)
.
The target value of type T
will be serialized using the provided Coder
. It
is explicitly not required or expected to be serializable via Java serialization.
public static <T extends java.io.Serializable> SerializableMatcher<java.lang.Iterable<? super T>> hasItem(T target)
SerializableMatcher
with identical criteria to Matchers.hasItem(Object)
.public static <T> SerializableMatcher<java.lang.Iterable<? super T>> hasItem(Coder<T> coder, T target)
SerializableMatcher
with identical criteria to Matchers.hasItem(Object)
.
The item of type T
will be serialized using the provided Coder
. It is
explicitly not required or expected to be serializable via Java serialization.
public static <T> SerializableMatcher<java.lang.Iterable<? super T>> hasItem(SerializableMatcher<? super T> matcher)
SerializableMatcher
with identical criteria to Matchers.hasItem(Matcher)
.public static <T> SerializableMatcher<java.util.Collection<? extends T>> hasSize(int size)
SerializableMatcher
with identical criteria to Matchers.hasSize(int)
.public static <T> SerializableMatcher<java.util.Collection<? extends T>> hasSize(SerializableMatcher<? super java.lang.Integer> sizeMatcher)
SerializableMatcher
with identical criteria to Matchers.hasSize(Matcher)
.public static <T> SerializableMatcher<java.lang.Iterable<T>> iterableWithSize(int size)
SerializableMatcher
with identical criteria to Matchers.iterableWithSize(int)
.public static <T> SerializableMatcher<java.lang.Iterable<T>> iterableWithSize(SerializableMatcher<? super java.lang.Integer> sizeMatcher)
SerializableMatcher
with identical criteria to Matchers.iterableWithSize(Matcher)
.public static <T extends java.io.Serializable> SerializableMatcher<T> isIn(java.util.Collection<T> collection)
SerializableMatcher
with identical criteria to Matchers.isIn(Collection)
.public static <T> SerializableMatcher<T> isIn(Coder<T> coder, java.util.Collection<T> collection)
SerializableMatcher
with identical criteria to Matchers.isIn(Collection)
.
The items of type T
will be serialized using the provided Coder
. They are
explicitly not required or expected to be serializable via Java serialization.
public static <T extends java.io.Serializable> SerializableMatcher<T> isIn(T[] items)
SerializableMatcher
with identical criteria to Matchers.isIn(Object[])
.public static <T> SerializableMatcher<T> isIn(Coder<T> coder, T[] items)
SerializableMatcher
with identical criteria to Matchers.isIn(Object[])
.
The items of type T
will be serialized using the provided Coder
. They are
explicitly not required or expected to be serializable via Java serialization.
@SafeVarargs public static <T extends java.io.Serializable> SerializableMatcher<T> isOneOf(T... elems)
SerializableMatcher
with identical criteria to Matchers.isOneOf(T...)
.@SafeVarargs public static <T> SerializableMatcher<T> isOneOf(Coder<T> coder, T... items)
SerializableMatcher
with identical criteria to Matchers.isOneOf(T...)
.
The items of type T
will be serialized using the provided Coder
. They are
explicitly not required or expected to be serializable via Java serialization.
public static <K extends java.io.Serializable,V> SerializableMatcher<KV<? extends K,? extends V>> kvWithKey(K key)
SerializableMatcher
that matches any KV
with the specified key.public static <K,V> SerializableMatcher<KV<? extends K,? extends V>> kvWithKey(Coder<K> coder, K key)
SerializableMatcher
that matches any KV
with the specified key.
The key of type K
will be serialized using the provided Coder
. It is
explicitly not required or expected to be serializable via Java serialization.
public static <K,V> SerializableMatcher<KV<? extends K,? extends V>> kvWithKey(SerializableMatcher<? super K> keyMatcher)
SerializableMatcher
that matches any KV
with matching key.public static <K,V extends java.io.Serializable> SerializableMatcher<KV<? extends K,? extends V>> kvWithValue(V value)
SerializableMatcher
that matches any KV
with the specified value.public static <K,V> SerializableMatcher<KV<? extends K,? extends V>> kvWithValue(Coder<V> coder, V value)
SerializableMatcher
that matches any KV
with the specified value.
The value of type V
will be serialized using the provided Coder
. It is
explicitly not required or expected to be serializable via Java serialization.
public static <K,V> SerializableMatcher<KV<? extends K,? extends V>> kvWithValue(SerializableMatcher<? super V> valueMatcher)
SerializableMatcher
that matches any KV
with matching value.public static <K,V> SerializableMatcher<KV<? extends K,? extends V>> kv(SerializableMatcher<? super K> keyMatcher, SerializableMatcher<? super V> valueMatcher)
SerializableMatcher
that matches any KV
with matching key and value.public static <T extends java.lang.Comparable<T> & java.io.Serializable> SerializableMatcher<T> lessThan(T target)
SerializableMatcher
with identical criteria to Matchers.lessThan(Comparable)
.public static <T extends java.lang.Comparable<T>> SerializableMatcher<T> lessThan(Coder<T> coder, T target)
SerializableMatcher
with identical criteria to Matchers.lessThan(Comparable)
.
The target value of type T
will be serialized using the provided Coder
. It
is explicitly not required or expected to be serializable via Java serialization.
public static <T extends java.lang.Comparable<T> & java.io.Serializable> SerializableMatcher<T> lessThanOrEqualTo(T target)
SerializableMatcher
with identical criteria to Matchers.lessThanOrEqualTo(Comparable)
.public static <T extends java.lang.Comparable<T>> SerializableMatcher<T> lessThanOrEqualTo(Coder<T> coder, T target)
SerializableMatcher
with identical criteria to Matchers.lessThanOrEqualTo(Comparable)
.
The target value of type T
will be serialized using the provided Coder
. It
is explicitly not required or expected to be serializable via Java serialization.
public static <T> SerializableMatcher<T> not(SerializableMatcher<T> matcher)
SerializableMatcher
with identical criteria to Matchers.not(org.hamcrest.Matcher<T>)
.public static SerializableMatcher<java.lang.Object> nullValue()
SerializableMatcher
with identical criteria to Matchers.nullValue()
.public static SerializableMatcher<java.lang.String> startsWith(java.lang.String substring)
SerializableMatcher
with identical criteria to Matchers.startsWith(java.lang.String)
.public static <T> SerializableMatcher<T> fromSupplier(SerializableMatchers.SerializableSupplier<Matcher<T>> supplier)
SerializableMatcher
from a non-serializable Matcher
via
indirection through SerializableMatchers.SerializableSupplier
.
To wrap a Matcher
which is not serializable, provide a SerializableMatchers.SerializableSupplier
with a SerializableMatchers.SerializableSupplier.get()
method that returns a fresh instance of the Matcher
desired. The resulting SerializableMatcher
will behave according to the Matcher
returned by get()
when it is invoked during
matching (which may occur on another machine).
return fromSupplier(new SerializableSupplier<Matcher<T>>() {
* @Override
public Matcher<T> get() {
return new MyMatcherForT();
}
});