Class AssertConsumeNone<T>

java.lang.Object
org.soliscode.test.assertions.actions.AssertConsumeNone<T>
Type Parameters:
T - element type
All Implemented Interfaces:
Consumer<T>, AssertAction, AssertConsumer<T>

public class AssertConsumeNone<T> extends Object implements AssertConsumer<T>

A consumer that expects to consume no objects. It will throw an exception if any object is consumed, including 'null'. Instead of instantiating this class directly, the AssertActions utility class should be used:

Consumer<Integer> consumer = AssertActions.consumeNone();
Since:
1.0
Author:
evanbergstrom
See Also:
  • Constructor Details

    • AssertConsumeNone

      public AssertConsumeNone()
      Create a consumer that expect to consume no objects.
    • AssertConsumeNone

      public AssertConsumeNone(@Nullable @Nullable String message)
      Create a consumer that expect to consume no objects. This constructor allows specification of a string to be included in the exception of the assertion fails.
      Parameters:
      message - the text to include in the exception.
    • AssertConsumeNone

      public AssertConsumeNone(@Nullable @Nullable Supplier<String> messageSupplier)
      Create a consumer that expect to consume no objects. This constructor allows specification of a supplier of a message to be included in the exception.
      Parameters:
      messageSupplier - the supplier of the text to include in the exception.
  • Method Details

    • accept

      public void accept(T e)
      Specified by:
      accept in interface Consumer<T>