Class GenericVerifications<T extends AnyScenarioType,​SELF extends GenericVerifications<T,​SELF>>

  • Type Parameters:
    SELF - the type of the subclass
    T - type of scenario
    All Implemented Interfaces:
    ScenarioType<T>

    @ThreadSafe
    public class GenericVerifications<T extends AnyScenarioType,​SELF extends GenericVerifications<T,​SELF>>
    extends StageEx<SELF>
    implements ScenarioType<T>
    Generic verifications.
    Author:
    aherscu
    • Constructor Detail

      • GenericVerifications

        public GenericVerifications()
        Logs the construction of this stage.
    • Method Detail

      • eventually

        @SafeVarargs
        public final SELF eventually​(Function<SELF,​SELF> step,
                                     net.jodah.failsafe.Policy<SELF>... additionalRetryPolicies)
        Repeatedly executes specified block on same thread, verifying its outcome matches the expected.
        Parameters:
        step - the block to execute
        additionalRetryPolicies - additional retry policies
        Returns:
        StageBase.self()
        Throws:
        AssertionError - if the supplied object does not match
      • eventually_assert_that

        @SafeVarargs
        public final <V> SELF eventually_assert_that​(Supplier<V> objectToBeAsserted,
                                                     org.hamcrest.Matcher<V> matcher,
                                                     net.jodah.failsafe.Policy<SELF>... additionalRetryPolicies)
        Asserts supplied object matches specified matcher on same thread. Upon AssertionError, asks for updated object and asserts again. Ignores all exceptions. The interval and duration of these assertions are configured via beforeScenarioConfigurePolling().
        Type Parameters:
        V - the type of object to assert upon
        Parameters:
        objectToBeAsserted - the supplied object to assert upon
        matcher - the matcher
        additionalRetryPolicies - additional retry policies
        Returns:
        StageBase.self()
        Throws:
        AssertionError - if the supplied object does not match
        See Also:
        beforeScenarioConfigurePolling()
      • should_succeed

        public SELF should_succeed​(org.hamcrest.Matcher<Boolean> matcher)
        Verifies that the expected is true.
        Parameters:
        matcher - the matching rule
        Returns:
        StageBase.self()
      • the_JSON_file_$_should_contain

        @As("the JSON file $ should contain")
        public SELF the_JSON_file_$_should_contain​(File jsonFile,
                                                   Iterable<? extends dev.aherscu.qa.testing.utils.assertions.JsonAssertion<?>> expectedContents)
        Verifies the contents of the specified JSON file.
        Parameters:
        jsonFile - the JSON file
        expectedContents - the expected contents
        Returns:
        StageBase.self()
      • the_file_$_should_contain

        public SELF the_file_$_should_contain​(File file,
                                              String contents)
        Verifies the contents of the specified file.

        IMPORTANT: not suitable for large files

        Parameters:
        file - the type of IDX file
        contents - the contents
        Returns:
        StageBase.self()
      • the_file_$_should_match

        public SELF the_file_$_should_match​(File file,
                                            org.hamcrest.Matcher<String> expected)
        Verifies the contents of the specified file.

        IMPORTANT: not suitable for large files

        Parameters:
        file - the type of IDX file
        expected - the contents to match
        Returns:
        StageBase.self()
      • beforeScenarioConfigurePolling

        protected void beforeScenarioConfigurePolling()
        Description copied from class: StageEx
        Configures the retry policy. Configurable via:
        • poll.delay -- defaults to 1 second
        • poll.timeout -- defaults to 10 seconds

        IMPORTANT: if you override this method, you should ensure that other policy properties are setup properly, either by calling this implementation via super.configureRetryPolicy(), or by other means.

        Overrides:
        beforeScenarioConfigurePolling in class StageEx<SELF extends GenericVerifications<T,​SELF>>