Class Extension_Mats

  • All Implemented Interfaces:
    org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.Extension

    public class Extension_Mats
    extends io.mats3.test.abstractunit.AbstractMatsTest<java.lang.String>
    implements org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.AfterAllCallback
    Provides a full MATS harness for unit testing by creating MatsFactory utilizing an in-vm Active MQ broker.

    By default the rule will create a MatsSerializer_DefaultJson which will be the serializer utilized by the created MatsFactory. Should one want to use a different serializer which serializes to the type of String then this can be specified using the method create(MatsSerializer). However should one want to specify a serializer which serializes into anything other than String, then Extension_MatsGeneric offers this possibility.

    Extension_Mats 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_Mats can be viewed in the same manner as one would view a ClassRule in JUnit4.

    Example:

         public class YourTestClass {
             @RegisterExtension
             public static final Extension_Mats MATS = Extension_Mats.createRule()
         }
     
    See Also:
    Extension_MatsGeneric
    • Field Summary

      • Fields inherited from class io.mats3.test.abstractunit.AbstractMatsTest

        _createdMatsFactories, _dataSource, _matsFactory, _matsFuturizer, _matsInitiator, _matsLocalVmActiveMq, _matsSerializer, _matsTestLatch, _matsTestMqInterface, log
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Extension_Mats​(io.mats3.serial.MatsSerializer<java.lang.String> matsSerializer)  
      protected Extension_Mats​(io.mats3.serial.MatsSerializer<java.lang.String> matsSerializer, javax.sql.DataSource dataSource)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void 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 Extension_Mats create()
      Creates an Extension_Mats utilizing the MATS default serializer
      static Extension_Mats create​(io.mats3.serial.MatsSerializer<java.lang.String> matsSerializer)
      Creates an Extension_Mats utilizing the user provided MatsSerializer which serializes to the type of String.
      static Extension_Mats createWithDb()  
      static Extension_Mats createWithDb​(io.mats3.serial.MatsSerializer<java.lang.String> matsSerializer)  
      • Methods inherited from class io.mats3.test.abstractunit.AbstractMatsTest

        afterAll, beforeAll, cleanMatsFactories, cleanMatsFactory, createMatsFactory, getDataSource, getDlqMessage, getJmsConnectionFactory, getJmsMatsFactory, getMatsFactory, getMatsFuturizer, getMatsInitiator, getMatsTestLatch, getMatsTestMqInterface, id
      • Methods inherited from class java.lang.Object

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

      • Extension_Mats

        protected Extension_Mats​(io.mats3.serial.MatsSerializer<java.lang.String> matsSerializer)
      • Extension_Mats

        protected Extension_Mats​(io.mats3.serial.MatsSerializer<java.lang.String> matsSerializer,
                                 javax.sql.DataSource dataSource)
    • Method Detail

      • create

        public static Extension_Mats create​(io.mats3.serial.MatsSerializer<java.lang.String> matsSerializer)
        Creates an Extension_Mats utilizing the user provided MatsSerializer which serializes to the type of String.
      • createWithDb

        public static Extension_Mats createWithDb​(io.mats3.serial.MatsSerializer<java.lang.String> matsSerializer)
      • 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 interface org.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 interface org.junit.jupiter.api.extension.AfterAllCallback