Package io.mats3.test.jupiter
Class Extension_MatsGeneric<Z>
- java.lang.Object
-
- io.mats3.test.abstractunit.AbstractMatsTest<Z>
-
- io.mats3.test.jupiter.Extension_MatsGeneric<Z>
-
- Type Parameters:
Z- The type definition for theMatsSerializeremployed. This defines the type which STOs and DTOs are serialized into. When employing JSON for the "outer" serialization of MatsTrace, it does not make that much sense to use a binary (Z=byte[]) "inner" representation of the DTOs and STOs, because JSON is terrible at serializing byte arrays.
- All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterAllCallback,org.junit.jupiter.api.extension.BeforeAllCallback,org.junit.jupiter.api.extension.Extension
public class Extension_MatsGeneric<Z> extends io.mats3.test.abstractunit.AbstractMatsTest<Z> implements org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.AfterAllCallbackSimilar toExtension_Mats, provides a full MATS harness for unit testing by creatingMatsFactoryutilizing an in-vm Active MQ broker. The difference between the two is that this Extension is open to the usage of more customizedMatsSerializers.Extension_MatsGenericshall be annotated withRegisterExtensionand the instance field shall be static for the Jupiter life cycle to pick up the extension at the correct time.Extension_MatsGenericcan be viewed in the same manner as one would view a ClassRule in JUnit4.public class YourTestClass { @RegisterExtension public static Extension_MatsGeneric<Z> mats = new Extension_MatsGeneric(new YourSerializer()) }This will ensure that Extension_MatsGeneric sets up the test harness correctly.- See Also:
AbstractMatsTest
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedExtension_MatsGeneric(io.mats3.serial.MatsSerializer<Z> matsSerializer)protectedExtension_MatsGeneric(io.mats3.serial.MatsSerializer<Z> matsSerializer, javax.sql.DataSource dataSource)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterAll(org.junit.jupiter.api.extension.ExtensionContext context)Executed by Jupiter after all test methods have been executed.voidbeforeAll(org.junit.jupiter.api.extension.ExtensionContext context)Executed by Jupiter before any test method is executed.static <Z> Extension_MatsGeneric<Z>create(io.mats3.serial.MatsSerializer<Z> matsSerializer)Creates anExtension_MatsGenericutilizing the user providedMatsSerializer.static <Z> Extension_MatsGeneric<Z>createWithDb(io.mats3.serial.MatsSerializer<Z> matsSerializer)io.mats3.test.TestH2DataSourcegetDataSource()
-
-
-
Method Detail
-
create
public static <Z> Extension_MatsGeneric<Z> create(io.mats3.serial.MatsSerializer<Z> matsSerializer)
Creates anExtension_MatsGenericutilizing the user providedMatsSerializer.
-
createWithDb
public static <Z> Extension_MatsGeneric<Z> createWithDb(io.mats3.serial.MatsSerializer<Z> matsSerializer)
-
getDataSource
public io.mats3.test.TestH2DataSource getDataSource()
- Overrides:
getDataSourcein classio.mats3.test.abstractunit.AbstractMatsTest<Z>
-
beforeAll
public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext context)
Executed by Jupiter before any test method is executed. (Once at the start of the class.)- Specified by:
beforeAllin interfaceorg.junit.jupiter.api.extension.BeforeAllCallback
-
afterAll
public void afterAll(org.junit.jupiter.api.extension.ExtensionContext context)
Executed by Jupiter after all test methods have been executed. (Once at the end of the class.)- Specified by:
afterAllin interfaceorg.junit.jupiter.api.extension.AfterAllCallback
-
-