Class TestSpringMatsFactoryProvider

java.lang.Object
io.mats3.spring.test.TestSpringMatsFactoryProvider

public class TestSpringMatsFactoryProvider extends Object
A testing-oriented MatsFactory-provider which utilizes the MatsTestBroker for the produced MatsFactory to connect to - this is for the scenarios where you do NOT have your test load the entire application's Spring configuration, but instead "piece together" the relevant Spring @Components containing test-relevant Mats endpoints and other beans from your application along with test-specific mocked-out endpoints: You will then probably not have the MatsFactory present in the Spring context. You can then use this class to get a "quick and dirty" MatsFactory (with an in-vm MQ Broker backing it) on which your application's endpoints, and mocked-out endpoints in the test, can run.

If your requirements aren't all that exotic, you may get this indirectly invoked by using the @MatsTestContext annotation directly on the Test-class. If your requirements are slightly more involved, check out the MatsTestInfrastructureConfiguration and MatsTestInfrastructureDbConfiguration Spring Configuration classes (loaded in a test with @ContextConfiguration), which employs the methods in this class.

See Also: