Class ResourceAssert<T>

java.lang.Object
org.assertj.core.api.AbstractAssert<ResourceAssert<T>, Resource<T>>
dmx.fun.assertj.ResourceAssert<T>
Type Parameters:
T - the resource value type
All Implemented Interfaces:
org.assertj.core.api.Assert<ResourceAssert<T>, Resource<T>>, org.assertj.core.api.Descriptable<ResourceAssert<T>>, org.assertj.core.api.ExtensionPoints<ResourceAssert<T>, Resource<T>>

@NullMarked public final class ResourceAssert<T> extends org.assertj.core.api.AbstractAssert<ResourceAssert<T>, Resource<T>>
AssertJ assertions for Resource.

Each assertion method exercises the resource's full acquire-use-release cycle by calling use(v -> v) (identity body) and inspecting the resulting Try.

Obtain instances via DmxFunAssertions.assertThat(Resource).

  • Field Summary

    Fields inherited from class org.assertj.core.api.AbstractAssert

    actual, info, myself, objects, throwUnsupportedExceptionOnEquals
  • Method Summary

    Modifier and Type
    Method
    Description
    failsWith(Class<? extends Throwable> exceptionType)
    Verifies that the resource's acquire-use-release cycle fails with an exception of the given type (or a subtype).
    Verifies that the resource's acquire-use-release cycle fails with an exception whose message contains the given string.
    succeedsWith(T expected)
    Verifies that the resource's acquire-use-release cycle succeeds and the acquired value equals expected.

    Methods inherited from class org.assertj.core.api.AbstractAssert

    actual, areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, doesNotHaveToString, doesNotMatch, doesNotMatch, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, hasToString, inBinary, inHexadecimal, is, isElementOfCustomAssert, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, usingEquals, usingEquals, usingRecursiveAssertion, usingRecursiveAssertion, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnError

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.assertj.core.api.Descriptable

    as, as, as, describedAs, describedAs
  • Method Details

    • succeedsWith

      public ResourceAssert<T> succeedsWith(T expected)
      Verifies that the resource's acquire-use-release cycle succeeds and the acquired value equals expected.
      Parameters:
      expected - the expected value produced by the resource
      Returns:
      this assertion for chaining
    • failsWith

      public ResourceAssert<T> failsWith(Class<? extends Throwable> exceptionType)
      Verifies that the resource's acquire-use-release cycle fails with an exception of the given type (or a subtype).
      Parameters:
      exceptionType - the expected exception type
      Returns:
      this assertion for chaining
    • failsWithMessage

      public ResourceAssert<T> failsWithMessage(String message)
      Verifies that the resource's acquire-use-release cycle fails with an exception whose message contains the given string.
      Parameters:
      message - the string expected to be contained in the failure message
      Returns:
      this assertion for chaining