TestConsumer
public final class TestConsumer<T extends Object> implements Consumer
An implementation of Consumer to capture values during a test and allows developers to perform assertions on the values.
| Parameters | |
|---|---|
<T extends Object> |
the type of the input to the operation |
Summary
Public constructors |
|---|
<T extends Object> TestConsumer() |
Public methods |
|
|---|---|
void |
Records the value in the order it was received. |
final void |
assertValues(@NonNull List<@NonNull T> values)Asserts that the |
Public constructors
TestConsumer
public <T extends Object> TestConsumer()
| Parameters | |
|---|---|
<T extends Object> |
the type of the input to the operation |
Public methods
accept
public void accept(@NonNull T t)
Records the value in the order it was received.
| Parameters | |
|---|---|
@NonNull T t |
the input argument. |
assertValues
public final void assertValues(@NonNull List<@NonNull T> values)
Asserts that the values match the received values. This method checks the order and the elements.
| Parameters | |
|---|---|
@NonNull List<@NonNull T> values |
expected to be in the |
| Throws | |
|---|---|
kotlin.AssertionError |
if the values do not match the current values. |