Class DmxFunAssertions

java.lang.Object
dmx.fun.assertj.DmxFunAssertions

@NullMarked public final class DmxFunAssertions extends Object
Entry point for AssertJ custom assertions for all dmx-fun types.

Use static imports for fluent syntax:

import static dmx.fun.assertj.DmxFunAssertions.assertThat;

assertThat(Option.some(42)).isSome().containsValue(42);
assertThat(Result.ok("hello")).isOk().containsValue("hello");
assertThat(Try.success(1)).isSuccess().containsValue(1);
assertThat(Validated.valid("ok")).isValid().containsValue("ok");
  • Method Details

    • assertThat

      public static <V> OptionAssert<V> assertThat(Option<V> actual)
      Creates an assertion for an Option.
      Type Parameters:
      V - the value type
      Parameters:
      actual - the Option to assert on
      Returns:
      a new OptionAssert
    • assertThat

      public static <V,E> ResultAssert<V,E> assertThat(Result<V,E> actual)
      Creates an assertion for a Result.
      Type Parameters:
      V - the success value type
      E - the error type
      Parameters:
      actual - the Result to assert on
      Returns:
      a new ResultAssert
    • assertThat

      public static <V> TryAssert<V> assertThat(Try<V> actual)
      Creates an assertion for a Try.
      Type Parameters:
      V - the success value type
      Parameters:
      actual - the Try to assert on
      Returns:
      a new TryAssert
    • assertThat

      public static <E,A> ValidatedAssert<E,A> assertThat(Validated<E,A> actual)
      Creates an assertion for a Validated.
      Type Parameters:
      E - the error type
      A - the value type
      Parameters:
      actual - the Validated to assert on
      Returns:
      a new ValidatedAssert
    • assertThat

      public static <A,B> Tuple2Assert<A,B> assertThat(Tuple2<A,B> actual)
      Creates an assertion for a Tuple2.
      Type Parameters:
      A - the first element type
      B - the second element type
      Parameters:
      actual - the Tuple2 to assert on
      Returns:
      a new Tuple2Assert
    • assertThat

      public static <A,B,C> Tuple3Assert<A,B,C> assertThat(Tuple3<A,B,C> actual)
      Creates an assertion for a Tuple3.
      Type Parameters:
      A - the first element type
      B - the second element type
      C - the third element type
      Parameters:
      actual - the Tuple3 to assert on
      Returns:
      a new Tuple3Assert
    • assertThat

      public static <A,B,C,D> Tuple4Assert<A,B,C,D> assertThat(Tuple4<A,B,C,D> actual)
      Creates an assertion for a Tuple4.
      Type Parameters:
      A - the first element type
      B - the second element type
      C - the third element type
      D - the fourth element type
      Parameters:
      actual - the Tuple4 to assert on
      Returns:
      a new Tuple4Assert