Package 

Class TestFixture

  • All Implemented Interfaces:

    
    public abstract class TestFixture
    
                        

    Base class for fixtures

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      TestFixture(ExtensionContext.Store store)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract Unit setup() Used to initialise fixture instance.
      abstract Unit teardown() Used to clean up fixture instance.
      final Unit store(Object value) Stores object in extension store shared by all fixtures.
      final <T extends Any> Unit store(KClass<in T> type, T value) Stores object in extension store shared by all fixtures.
      final <T extends Any> Unit store(Class<in T> type, T value) See store
      final <T extends Any> T retrieve(KClass<T> type) Retrieves object from extension store shared by all fixtures.
      final <T extends Any> T retrieve(Class<T> type) See retrieve
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TestFixture

        TestFixture(ExtensionContext.Store store)
        Parameters:
        store - extension store used to store and retrieve dependencies across all fixtures
    • Method Detail

      • setup

         abstract Unit setup()

        Used to initialise fixture instance. Called before test's org.junit.jupiter.api.BeforeAll methods

      • teardown

         abstract Unit teardown()

        Used to clean up fixture instance. Called after test's org.junit.jupiter.api.AfterAll methods

      • store

         final Unit store(Object value)

        Stores object in extension store shared by all fixtures. The object is stored under the key corresponding to its direct class

        Parameters:
        value - object to be stored
      • store

         final <T extends Any> Unit store(KClass<in T> type, T value)

        Stores object in extension store shared by all fixtures. The object is stored under given type as the key

        Parameters:
        type - key reference
        value - object to be stored
      • retrieve

         final <T extends Any> T retrieve(KClass<T> type)

        Retrieves object from extension store shared by all fixtures.

        Parameters:
        type - type of desired object or null if not present in the store