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 theMatsSerializer
employed. 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 AbstractMatsTest<Z>
implements org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.AfterAllCallback
Similar to
Extension_Mats
, provides a full MATS harness for unit testing by creating MatsFactory
utilizing an in-vm Active MQ broker. The difference between the two is that this Extension is open to
the usage of more customized MatsSerializer
s.
Extension_MatsGeneric
shall be annotated with RegisterExtension
and
the instance field shall be static for the Jupiter life cycle to pick up the extension at the correct time.
Extension_MatsGeneric
can 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:
-
Field Summary
Fields inherited from class io.mats3.test.abstractunit.AbstractMatsTest
_createdMatsFactories, _dataSource, _matsFactory, _matsFuturizer, _matsInitiator, _matsSerializer, _matsTestBroker, _matsTestBrokerInterface, _matsTestLatch, log
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Extension_MatsGeneric
(MatsSerializer<Z> matsSerializer) protected
Extension_MatsGeneric
(MatsSerializer<Z> matsSerializer, DataSource dataSource) -
Method Summary
Modifier and TypeMethodDescriptionvoid
afterAll
(org.junit.jupiter.api.extension.ExtensionContext context) Executed by Jupiter after all test methods have been executed.void
beforeAll
(org.junit.jupiter.api.extension.ExtensionContext context) Executed by Jupiter before any test method is executed.static <Z> Extension_MatsGeneric<Z>
create
(MatsSerializer<Z> matsSerializer) Creates anExtension_MatsGeneric
utilizing the user providedMatsSerializer
.static <Z> Extension_MatsGeneric<Z>
createWithDb
(MatsSerializer<Z> matsSerializer) Methods inherited from class io.mats3.test.abstractunit.AbstractMatsTest
afterAll, beforeAll, cleanMatsFactories, cleanMatsFactory, createMatsFactory, getJmsConnectionFactory, getMatsFactory, getMatsFuturizer, getMatsInitiator, getMatsInterceptableMatsFactory, getMatsTestBrokerInterface, getMatsTestLatch, id
-
Constructor Details
-
Extension_MatsGeneric
-
Extension_MatsGeneric
-
-
Method Details
-
create
Creates anExtension_MatsGeneric
utilizing the user providedMatsSerializer
. -
createWithDb
-
getDataSource
- Overrides:
getDataSource
in classAbstractMatsTest<Z>
- Returns:
- the DataSource if this Rule/Extension was created with one, throws
IllegalStateException
otherwise.
-
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:
beforeAll
in 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:
afterAll
in interfaceorg.junit.jupiter.api.extension.AfterAllCallback
-