diff options
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java b/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java index 78dafdc..01b7745 100644 --- a/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java +++ b/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java @@ -1,11 +1,18 @@ package at.gv.egiz.moazs; +import at.gv.e_government.reference.namespace.zustellung.msg.phase2._20181206_.ObjectFactory; +import at.gv.egiz.moazs.pipeline.DeliveryPipeline; +import at.gv.egiz.moazs.repository.DeliveryRepository; import org.junit.Test; import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.boot.test.context.TestConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Primary; import org.springframework.test.context.junit4.SpringRunner; import java.io.IOException; @@ -27,7 +34,29 @@ public class App2MzsServiceTest { private final String basePath = "src/test/resources/at/gv/egiz/moazs/App2MzsServiceTest/"; - Logger logger = LoggerFactory.getLogger(App2MzsServiceTest.class); + private final static Logger logger = LoggerFactory.getLogger(App2MzsServiceTest.class); + + @TestConfiguration + public static class TestConfig { + + @Autowired + private DeliveryRepository repository; + + private final ObjectFactory factory = new ObjectFactory(); + + @Bean + @Primary + public DeliveryPipeline deliveryPipelineThatAlwaysSucceeds() { + return appDeliveryId -> { + var status = factory.createDeliveryRequestStatusType(); + var success = factory.createDeliveryRequestStatusTypeSuccess(); + success.setAppDeliveryID(appDeliveryId); + status.setSuccess(success); + repository.add(status); + }; + } + } + @Test public void acceptValidDeliveryRequest() throws IOException, InterruptedException { |