Class AssertActions

java.lang.Object
org.soliscode.test.assertions.actions.AssertActions

public final class AssertActions extends Object
Utility class for creating assertion actions to provide to methods that are being tested. Three versions of each method are provided, with two versions allowing the provision of additional message text.
Since:
1.o
Author:
evanbergstrom
  • Method Details

    • consumeOnly

      @NotNull public static <T> @NotNull AssertConsumer<T> consumeOnly(@NotNull @NotNull Iterable<T> expected)
      Creates a consumer that checks that it only consumes objects from a specified set of objects.
      Type Parameters:
      T - the type of object being consumed.
      Parameters:
      expected - the set of objects that should be consumed.
      Returns:
      a consumer that expects a specific set of objects.
      See Also:
    • consumeOnly

      @NotNull public static <T> @NotNull AssertConsumer<T> consumeOnly(@NotNull @NotNull Iterable<T> expected, @Nullable @Nullable String message)
      Creates a consumer that checks that it only consumes objects from a specified set of objects. This method allows specification of a string to be included in the exception of the assertion fails.
      Type Parameters:
      T - the type of object being consumed.
      Parameters:
      expected - the set of objects that should be consumed.
      message - the text to include in the exception.
      Returns:
      a consumer that expects a specific set of objects.
    • consumeOnly

      @NotNull public static <T> @NotNull AssertConsumer<T> consumeOnly(@NotNull @NotNull Iterable<T> expected, @Nullable @Nullable Supplier<String> messageSupplier)
      Creates a consumer that checks that it only consumes objects from a specified set of objects. This method allows specification of a supplier of a message to be included in the exception.
      Type Parameters:
      T - the type of object being consumed.
      Parameters:
      expected - the set of objects that should be consumed.
      messageSupplier - the supplier of the text to include in the exception.
      Returns:
      a consumer that expects a specific set of objects.
    • consumeExactly

      public static <T> AssertConsumer<T> consumeExactly(@NotNull @NotNull Iterable<T> expected)
      A consumer that checks that is consumes a specified set of objects.
      Type Parameters:
      T - the type of object being consumed.
      Parameters:
      expected - the set of objects that should be consumed.
      Returns:
      a consumer that expects a specific set of objects.
      See Also:
    • consumeExactly

      public static <T> AssertConsumer<T> consumeExactly(@NotNull @NotNull Iterable<T> expected, @Nullable @Nullable String message)
      A consumer that checks that is consumes a specified set of objects. This method allows specification of a string to be included in the exception of the assertion fails.
      Type Parameters:
      T - the type of object being consumed.
      Parameters:
      expected - the set of objects that should be consumed.
      message - the text to include in the exception.
      Returns:
      a consumer that expects a specific set of objects.
      See Also:
    • consumeExactly

      public static <T> AssertConsumer<T> consumeExactly(@NotNull @NotNull Iterable<T> expected, @Nullable @Nullable Supplier<String> messageSupplier)
      A consumer that checks that is consumes a specified set of objects. This method allows specification of a supplier of a message to be included in the exception.
      Type Parameters:
      T - the type of object being consumed.
      Parameters:
      expected - the set of objects that should be consumed.
      messageSupplier - the supplier of the text to include in the exception.
      Returns:
      a consumer that expects a specific set of objects.
      See Also:
    • consumeCount

      public static <T> AssertConsumer<T> consumeCount(int expected)
      Create a consumer that expect to consume a specified number of objects.
      Type Parameters:
      T - the type of object being consumed.
      Parameters:
      expected - the number of objects to expect.
      Returns:
      a consumer that expects the specified number of objects.
      See Also:
    • consumeCount

      public static <T> AssertConsumer<T> consumeCount(int expected, @Nullable @Nullable String message)
      Create a consumer that expect to consume a specified number of objects. This method allows specification of a string to be included in the exception of the assertion fails.
      Type Parameters:
      T - the type of object being consumed.
      Parameters:
      expected - the number of objects to expect.
      message - the text to include in the exception.
      Returns:
      a consumer that expects the specified number of objects.
      See Also:
    • consumeCount

      public static <T> AssertConsumer<T> consumeCount(int expected, @Nullable @Nullable Supplier<String> messageSupplier)
      Create a consumer that expect to consume a specified number of objects. This method allows specification of a supplier of a message to be included in the exception.
      Type Parameters:
      T - the type of object being consumed.
      Parameters:
      expected - the number of objects to expect.
      messageSupplier - the supplier of the text to include in the exception.
      Returns:
      a consumer that expects the specified number of objects.
      See Also:
    • assertConsumeNone

      public static <T> AssertConsumer<T> assertConsumeNone()
      Create a consumer that expect to consume no objects.
      Type Parameters:
      T - the type of object being consumed.
      Returns:
      a consumer that expects no objects.
      See Also:
    • assertConsumeNone

      public static <T> AssertConsumer<T> assertConsumeNone(@Nullable @Nullable String message)
      Create a consumer that expect to consume no objects. This method allows specification of a string to be included in the exception of the assertion fails.
      Type Parameters:
      T - the type of object being consumed.
      Parameters:
      message - the text to include in the exception.
      Returns:
      a consumer that expects no objects.
      See Also:
    • assertConsumeNone

      public static <T> AssertConsumer<T> assertConsumeNone(@Nullable @Nullable Supplier<String> messageSupplier)
      Create a consumer that expect to consume no objects. This method allows specification of a supplier of a message to be included in the exception.
      Type Parameters:
      T - the type of object being consumed.
      Parameters:
      messageSupplier - the supplier of the text to include in the exception.
      Returns:
      a consumer that expects no objects.
      See Also: