aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/at/gv/egiz
diff options
context:
space:
mode:
authorChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-03-19 13:07:48 +0100
committerChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-03-19 13:07:48 +0100
commitf704c3ca51c7023128d3dc124f803884ca2cee6f (patch)
tree5a3401d0fe416ece4ab9c0184555b04fb6565a01 /src/test/java/at/gv/egiz
parent7b3a0d2b5522ae4d43ef384e63d03d07438c23d9 (diff)
downloadmoa-zs-f704c3ca51c7023128d3dc124f803884ca2cee6f.tar.gz
moa-zs-f704c3ca51c7023128d3dc124f803884ca2cee6f.tar.bz2
moa-zs-f704c3ca51c7023128d3dc124f803884ca2cee6f.zip
Add Unit Tests "Reject Formally Incorrect Delivery Request"
Diffstat (limited to 'src/test/java/at/gv/egiz')
-rw-r--r--src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java b/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java
index 836bfab..5879fa2 100644
--- a/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java
+++ b/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java
@@ -16,6 +16,7 @@ import java.net.http.HttpResponse;
import java.nio.file.Paths;
import static java.net.http.HttpClient.*;
+import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT)
@@ -24,12 +25,14 @@ public class App2MzsServiceTest {
private final String serviceUri = "http://localhost:8080/services/DeliveryRequest";
- private final String payloadFile = "src/test/resources/delivery_request_app2mzs.soap";
+ private final String basePath = "src/test/resources/at/gv/egiz/moazs/App2MzsServiceTest/";
Logger logger = LoggerFactory.getLogger(App2MzsServiceTest.class);
@Test
- public void testService() throws IOException, InterruptedException {
+ public void acceptValidDeliveryRequest() throws IOException, InterruptedException {
+
+ final String payloadFile = basePath + "validDeliveryRequest.soap";
var client = HttpClient.newBuilder().version(Version.HTTP_1_1).build();
var request = HttpRequest.newBuilder()
@@ -42,5 +45,27 @@ public class App2MzsServiceTest {
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
logger.info("response.body was " + response.body());
logger.info("response.code was " + response.statusCode());
+
+ //TODO Verify response
+
+ }
+
+ @Test
+ public void rejectFormallyIncorrectDeliveryRequest() throws IOException, InterruptedException {
+
+ var invalidDeliveryRequest = basePath + "formallyIncorrectDeliveryRequest.soap";
+
+ var client = HttpClient.newBuilder().version(Version.HTTP_1_1).build();
+ var request = HttpRequest.newBuilder()
+ .uri(URI.create(serviceUri))
+ .header("Content-Type", "text/xml;charset=UTF-8")
+ .header("SOAPAction", "\"\"")
+ .POST(HttpRequest.BodyPublishers.ofFile(Paths.get(invalidDeliveryRequest)))
+ .build();
+
+ var response = client.send(request, HttpResponse.BodyHandlers.ofString());
+ assertThat(response.statusCode()).isEqualTo(500);
+
}
+
}