CursorMatchers


public final class CursorMatchers


A collection of Hamcrest matchers that matches a data row in a Cursor.

AdapterViews that are backed by a Cursor are very common. This class contains Matcher s that can be used together with onData to match a data row in a Cursor. The Matchers can only operate on a single data row of the cursor and Espresso internally moves the Cursor to the correct adapter position.

Summary

Nested types

A Matcher that matches Cursors based on values in their columns.

Public methods

static CursorMatchers.CursorMatcher
withRowBlob(int columnIndex, byte[] value)

Returns a matcher that matches a byte[] at a given column index in a Cursors data row.

static CursorMatchers.CursorMatcher
withRowBlob(int columnIndex, Matcher<byte[]> valueMatcher)

Returns a matcher that matches a byte[] at a given column index in a Cursors data row.

static CursorMatchers.CursorMatcher
withRowBlob(String columnName, byte[] value)

Returns a matcher that matches a byte[] at a given column index in a Cursors data row.

static CursorMatchers.CursorMatcher
withRowBlob(String columnName, Matcher<byte[]> valueMatcher)

Returns a matcher that matches a byte[] at a given column index in a Cursors data row.

static CursorMatchers.CursorMatcher
withRowBlob(Matcher<String> columnPicker, Matcher<byte[]> valueMatcher)

Returns a matcher that matches a byte[] at a given column index in a Cursors data row.

static CursorMatchers.CursorMatcher
withRowDouble(int columnIndex, double value)

Returns a matcher that matches a Double value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowDouble(int columnIndex, Matcher<Double> valueMatcher)

Returns a matcher that matches a Double value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowDouble(String columnName, double value)

Returns a matcher that matches a Double value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowDouble(String columnName, Matcher<Double> valueMatcher)

Returns a matcher that matches a Double value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowDouble(
    Matcher<String> columnNameMatcher,
    Matcher<Double> valueMatcher
)

Returns a matcher that matches a Double value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowFloat(int columnIndex, float value)

Returns a matcher that matches a Float value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowFloat(int columnIndex, Matcher<Float> valueMatcher)

Returns a matcher that matches a Float value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowFloat(String columnName, float value)

Returns a matcher that matches a Float value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowFloat(String columnName, Matcher<Float> valueMatcher)

Returns a matcher that matches a Float value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowFloat(
    Matcher<String> columnNameMatcher,
    Matcher<Float> valueMatcher
)

Returns a matcher that matches a Float value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowInt(int columnIndex, int value)

Returns a matcher that matches a Integer value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowInt(int columnIndex, Matcher<Integer> valueMatcher)

Returns a matcher that matches a Integer value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowInt(String columnName, int value)

Returns a matcher that matches a Integer value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowInt(String columnName, Matcher<Integer> valueMatcher)

Returns a matcher that matches a Integer value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowInt(
    Matcher<String> columnNameMatcher,
    Matcher<Integer> valueMatcher
)

Returns a matcher that matches a Integer value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowLong(int columnIndex, long value)

Returns a matcher that matches a Long value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowLong(int columnIndex, Matcher<Long> valueMatcher)

Returns a matcher that matches a Long value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowLong(String columnName, long value)

Returns a matcher that matches a Long value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowLong(String columnName, Matcher<Long> valueMatcher)

Returns a matcher that matches a Long value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowLong(
    Matcher<String> columnNameMatcher,
    Matcher<Long> valueMatcher
)

Returns a matcher that matches a Long value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowShort(int columnIndex, short value)

Returns a matcher that matches a Short value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowShort(int columnIndex, Matcher<Short> valueMatcher)

Returns a matcher that matches a Short value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowShort(String columnName, short value)

Returns a matcher that matches a Short value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowShort(String columnName, Matcher<Short> valueMatcher)

Returns a matcher that matches a Short value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowShort(
    Matcher<String> columnNameMatcher,
    Matcher<Short> valueMatcher
)

Returns a matcher that matches a Short value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowString(int columnIndex, String value)

Returns a matcher that matches a String value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowString(int columnIndex, Matcher<String> valueMatcher)

Returns a matcher that matches a String value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowString(String columnName, String value)

Returns a matcher that matches a String value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowString(String columnName, Matcher<String> valueMatcher)

Returns a matcher that matches a String value at a given column index in a s data row.

static CursorMatchers.CursorMatcher
withRowString(
    Matcher<String> columnPicker,
    Matcher<String> valueMatcher
)

Returns a matcher that matches a String value at a given column index in a s data row.

Public methods

withRowBlob

public static CursorMatchers.CursorMatcher withRowBlob(int columnIndex, byte[] value)

Returns a matcher that matches a byte[] at a given column index in a Cursors data row.

Parameters
int columnIndex

int column index

byte[] value

byte[] to match

withRowBlob

public static CursorMatchers.CursorMatcher withRowBlob(int columnIndex, Matcher<byte[]> valueMatcher)

Returns a matcher that matches a byte[] at a given column index in a Cursors data row.

Parameters
int columnIndex

int column index

Matcher<byte[]> valueMatcher

a Matcher that matches a byte[]

withRowBlob

public static CursorMatchers.CursorMatcher withRowBlob(String columnName, byte[] value)

Returns a matcher that matches a byte[] at a given column index in a Cursors data row.

Parameters
String columnName

as a String

byte[] value

byte[] to match

withRowBlob

public static CursorMatchers.CursorMatcher withRowBlob(String columnName, Matcher<byte[]> valueMatcher)

Returns a matcher that matches a byte[] at a given column index in a Cursors data row.

Parameters
String columnName

as a String

Matcher<byte[]> valueMatcher

a Matcher that matches a byte[]

withRowBlob

public static CursorMatchers.CursorMatcher withRowBlob(Matcher<String> columnPicker, Matcher<byte[]> valueMatcher)

Returns a matcher that matches a byte[] at a given column index in a Cursors data row.

Parameters
Matcher<String> columnPicker

as a Matcher of String

Matcher<byte[]> valueMatcher

a Matcher that matches a byte[]

withRowDouble

public static CursorMatchers.CursorMatcher withRowDouble(int columnIndex, double value)

Returns a matcher that matches a Double value at a given column index in a s data row.

Parameters
int columnIndex

int column index

double value

a double value to match

withRowDouble

public static CursorMatchers.CursorMatcher withRowDouble(int columnIndex, Matcher<Double> valueMatcher)

Returns a matcher that matches a Double value at a given column index in a s data row.

Parameters
int columnIndex

int column index

Matcher<Double> valueMatcher

a Matcher that matches a Double value

withRowDouble

public static CursorMatchers.CursorMatcher withRowDouble(String columnName, double value)

Returns a matcher that matches a Double value at a given column index in a s data row.

Parameters
String columnName

as a String

double value

a double value to match

withRowDouble

public static CursorMatchers.CursorMatcher withRowDouble(String columnName, Matcher<Double> valueMatcher)

Returns a matcher that matches a Double value at a given column index in a s data row.

Parameters
String columnName

as a String

Matcher<Double> valueMatcher

a Matcher that matches a Double value

withRowDouble

public static CursorMatchers.CursorMatcher withRowDouble(
    Matcher<String> columnNameMatcher,
    Matcher<Double> valueMatcher
)

Returns a matcher that matches a Double value at a given column index in a s data row.

Parameters
Matcher<String> columnNameMatcher

as a Matcher of String

Matcher<Double> valueMatcher

a Matcher that matches a Double value

withRowFloat

public static CursorMatchers.CursorMatcher withRowFloat(int columnIndex, float value)

Returns a matcher that matches a Float value at a given column index in a s data row.

Parameters
int columnIndex

int column index

float value

a float value to match

withRowFloat

public static CursorMatchers.CursorMatcher withRowFloat(int columnIndex, Matcher<Float> valueMatcher)

Returns a matcher that matches a Float value at a given column index in a s data row.

Parameters
int columnIndex

int column index

Matcher<Float> valueMatcher

a Matcher that matches a Float value

withRowFloat

public static CursorMatchers.CursorMatcher withRowFloat(String columnName, float value)

Returns a matcher that matches a Float value at a given column index in a s data row.

Parameters
String columnName

as a String

float value

a float value to match

withRowFloat

public static CursorMatchers.CursorMatcher withRowFloat(String columnName, Matcher<Float> valueMatcher)

Returns a matcher that matches a Float value at a given column index in a s data row.

Parameters
String columnName

as a String

Matcher<Float> valueMatcher

a Matcher that matches a Float value

withRowFloat

public static CursorMatchers.CursorMatcher withRowFloat(
    Matcher<String> columnNameMatcher,
    Matcher<Float> valueMatcher
)

Returns a matcher that matches a Float value at a given column index in a s data row.

Parameters
Matcher<String> columnNameMatcher

as a Matcher of String

Matcher<Float> valueMatcher

a Matcher that matches a Float value

withRowInt

public static CursorMatchers.CursorMatcher withRowInt(int columnIndex, int value)

Returns a matcher that matches a Integer value at a given column index in a s data row.

Parameters
int columnIndex

int column index

int value

a int value to match

withRowInt

public static CursorMatchers.CursorMatcher withRowInt(int columnIndex, Matcher<Integer> valueMatcher)

Returns a matcher that matches a Integer value at a given column index in a s data row.

Parameters
int columnIndex

int column index

Matcher<Integer> valueMatcher

a Matcher that matches a Integer value

withRowInt

public static CursorMatchers.CursorMatcher withRowInt(String columnName, int value)

Returns a matcher that matches a Integer value at a given column index in a s data row.

Parameters
String columnName

as a String

int value

a int value to match

withRowInt

public static CursorMatchers.CursorMatcher withRowInt(String columnName, Matcher<Integer> valueMatcher)

Returns a matcher that matches a Integer value at a given column index in a s data row.

Parameters
String columnName

as a String

Matcher<Integer> valueMatcher

a Matcher that matches a Integer value

withRowInt

public static CursorMatchers.CursorMatcher withRowInt(
    Matcher<String> columnNameMatcher,
    Matcher<Integer> valueMatcher
)

Returns a matcher that matches a Integer value at a given column index in a s data row.

Parameters
Matcher<String> columnNameMatcher

as a Matcher of String

Matcher<Integer> valueMatcher

a Matcher that matches a Integer value

withRowLong

public static CursorMatchers.CursorMatcher withRowLong(int columnIndex, long value)

Returns a matcher that matches a Long value at a given column index in a s data row.

Parameters
int columnIndex

int column index

long value

a long value to match

withRowLong

public static CursorMatchers.CursorMatcher withRowLong(int columnIndex, Matcher<Long> valueMatcher)

Returns a matcher that matches a Long value at a given column index in a s data row.

Parameters
int columnIndex

int column index

Matcher<Long> valueMatcher

a Matcher that matches a Long value

withRowLong

public static CursorMatchers.CursorMatcher withRowLong(String columnName, long value)

Returns a matcher that matches a Long value at a given column index in a s data row.

Parameters
String columnName

as a String

long value

a long value to match

withRowLong

public static CursorMatchers.CursorMatcher withRowLong(String columnName, Matcher<Long> valueMatcher)

Returns a matcher that matches a Long value at a given column index in a s data row.

Parameters
String columnName

as a String

Matcher<Long> valueMatcher

a Matcher that matches a Long value

withRowLong

public static CursorMatchers.CursorMatcher withRowLong(
    Matcher<String> columnNameMatcher,
    Matcher<Long> valueMatcher
)

Returns a matcher that matches a Long value at a given column index in a s data row.

Parameters
Matcher<String> columnNameMatcher

as a Matcher of String

Matcher<Long> valueMatcher

a Matcher that matches a Long value

withRowShort

public static CursorMatchers.CursorMatcher withRowShort(int columnIndex, short value)

Returns a matcher that matches a Short value at a given column index in a s data row.

Parameters
int columnIndex

int column index

short value

a short value to match

withRowShort

public static CursorMatchers.CursorMatcher withRowShort(int columnIndex, Matcher<Short> valueMatcher)

Returns a matcher that matches a Short value at a given column index in a s data row.

Parameters
int columnIndex

int column index

Matcher<Short> valueMatcher

a Matcher that matches a Short value

withRowShort

public static CursorMatchers.CursorMatcher withRowShort(String columnName, short value)

Returns a matcher that matches a Short value at a given column index in a s data row.

Parameters
String columnName

as a String

short value

a short value to match

withRowShort

public static CursorMatchers.CursorMatcher withRowShort(String columnName, Matcher<Short> valueMatcher)

Returns a matcher that matches a Short value at a given column index in a s data row.

Parameters
String columnName

as a String

Matcher<Short> valueMatcher

a Matcher that matches a Short value

withRowShort

public static CursorMatchers.CursorMatcher withRowShort(
    Matcher<String> columnNameMatcher,
    Matcher<Short> valueMatcher
)

Returns a matcher that matches a Short value at a given column index in a s data row.

Parameters
Matcher<String> columnNameMatcher

as a Matcher of String

Matcher<Short> valueMatcher

a Matcher that matches a Short value

withRowString

public static CursorMatchers.CursorMatcher withRowString(int columnIndex, String value)

Returns a matcher that matches a String value at a given column index in a s data row.

Parameters
int columnIndex

int column index

String value

a String value to match

withRowString

public static CursorMatchers.CursorMatcher withRowString(int columnIndex, Matcher<String> valueMatcher)

Returns a matcher that matches a String value at a given column index in a s data row.

Parameters
int columnIndex

int column index

Matcher<String> valueMatcher

a Matcher that matches a String value

withRowString

public static CursorMatchers.CursorMatcher withRowString(String columnName, String value)

Returns a matcher that matches a String value at a given column index in a s data row.

Parameters
String columnName

as a String

String value

a String value to match

withRowString

public static CursorMatchers.CursorMatcher withRowString(String columnName, Matcher<String> valueMatcher)

Returns a matcher that matches a String value at a given column index in a s data row.

Parameters
String columnName

as a String

Matcher<String> valueMatcher

a Matcher that matches a String value

withRowString

public static CursorMatchers.CursorMatcher withRowString(
    Matcher<String> columnPicker,
    Matcher<String> valueMatcher
)

Returns a matcher that matches a String value at a given column index in a s data row.

Parameters
Matcher<String> columnPicker

as a Matcher of String

Matcher<String> valueMatcher

a Matcher that matches a String value