Class SoftAssertions

java.lang.Object
com.qaitsolutions.pframe.core.assertion.SoftAssertions

public final class SoftAssertions extends Object
SoftAssertion implementation over Truth.

Since:
1.0
Author:
Iulian Andrei (iulian.andrei@qaitsolutions.com)
  • Constructor Details

    • SoftAssertions

      public SoftAssertions()
  • Method Details

    • assertAll

      public void assertAll()
      Fails when previous asserts fail and failures are registered in the tracker. After fail, the tracker is emptied so that it can be used again.
      Throws:
      AssertionError - If any error has been registered to the point of using this method.
    • assertThat

      public IntegerSubject assertThat(Integer actual)
      Wrapper over Truth.assertThat(Integer).

      Parameters:
      actual - Current Integer value to be verified.
      Returns:
      IntegerSubject with integer specific assertions methods.
    • assertThat

      public IterableSubject assertThat(Iterable<?> actual)
      Wrapper over Truth.assertThat(Iterable).

      Parameters:
      actual - Current Iterable value to be verified.
      Returns:
      IterableSubject with specific assertions methods.
    • assertThat

      public BooleanSubject assertThat(Boolean actual)
      Wrapper over Truth.assertThat(Boolean).

      Parameters:
      actual - Current Boolean value to be verified.
      Returns:
      BooleanSubject with specific assertions methods.
    • assertThat

      public DoubleSubject assertThat(Double actual)
      Wrapper over Truth.assertThat(Double).

      Parameters:
      actual - Current Double value to be verified.
      Returns:
      DoubleSubject with specific assertions methods.
    • assertThat

      public DoubleSubject assertThat(Float actual)
      Wrapper over Truth.assertThat(Float).

      Parameters:
      actual - Current Float value to be verified.
      Returns:
      DoubleSubject with specific assertions methods.
    • assertThat

      public LongSubject assertThat(Long actual)
      Wrapper over Truth.assertThat(Long).

      Parameters:
      actual - Current Long value to be verified.
      Returns:
      LongSubject with specific assertions methods.
    • assertThat

      public StringSubject assertThat(String actual)
      Wrapper over Truth.assertThat(String).

      Parameters:
      actual - Current String value to be verified.
      Returns:
      StringSubject with specific assertions methods.
    • assertThat

      public <T extends Comparable<?>> ComparableSubject<T> assertThat(T actual)
      Wrapper over Truth.assertThat(Comparable).

      Parameters:
      actual - Current Comparable value to be verified.
      Returns:
      ComparableSubject with specific assertions methods.
    • assertThat

      public Subject assertThat(Object actual)
      Wrapper over Truth.assertThat(Object).

      Parameters:
      actual - Current Object value to be verified.
      Returns:
      Subject with specific assertions methods.
    • assertThat

      public MapSubject assertThat(Map<?,?> actual)
      Wrapper over Truth.assertThat(Map).

      Parameters:
      actual - Current Map value to be verified.
      Returns:
      MapSubject with specific assertions methods.
    • assertThat

      public BigDecimalSubject assertThat(BigDecimal actual)
      Wrapper over Truth.assertThat(BigDecimal).

      Parameters:
      actual - Current BigDecimal value to be verified.
      Returns:
      BigDecimalSubject with specific assertions methods.
    • assertWithMessage

      public SoftAssertions assertWithMessage(String message)
      Wrapper over Truth.assertWithMessage(String).

      Parameters:
      message - Text that will be added to the log/report.
      Returns:
      A self reference..
    • assertWithMessage

      public SoftAssertions assertWithMessage(String format, Object... args)
      Wrapper over Truth.assertWithMessage(String, Object...).

      Parameters:
      format - Text that will be added to the log/report in String.format(String, Object...).
      args - Arguments referenced by the format specifiers in the format string.
      Returns:
      A self reference.
    • softFail

      public void softFail()
      Will add a fail (error) in the error list but will not fail until assertAll() method is used. Wrapper over StandardSubjectBuilder.fail().
    • hardFail

      public void hardFail()
      Will fail (error) when used. Wrapper over StandardSubjectBuilder.fail().

      Throws:
      AssertionError - When method is used it will throw Error.