aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/at/gv/egiz/moazs/ITEndToEndTest.java24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/test/java/at/gv/egiz/moazs/ITEndToEndTest.java b/src/test/java/at/gv/egiz/moazs/ITEndToEndTest.java
index fd2e629..29b7b53 100644
--- a/src/test/java/at/gv/egiz/moazs/ITEndToEndTest.java
+++ b/src/test/java/at/gv/egiz/moazs/ITEndToEndTest.java
@@ -12,6 +12,8 @@ import at.gv.zustellung.msg.xsd.DeliveryRequestStatusType;
import at.gv.zustellung.msg.xsd.DeliveryRequestType;
import at.gv.zustellung.tnvz.xsd.TNVZServicePort;
import org.apache.commons.io.FileUtils;
+import org.awaitility.Awaitility;
+import org.awaitility.Duration;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -45,6 +47,7 @@ import static at.gv.zustellung.msg.xsd.DeliveryRequestStatusType.deliveryRequest
import static java.net.http.HttpResponse.BodyHandlers.ofString;
import static org.apache.commons.io.FileUtils.readFileToString;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.awaitility.Awaitility.await;
import static org.mockito.Mockito.*;
@RunWith(SpringRunner.class)
@@ -165,10 +168,10 @@ public class ITEndToEndTest {
DELIVERY_SYSTEM, zsDeliveryID, appDeliveryID, GZ_WATERMARK, timestamp
});
sendMsgResponse(msgStatus);
- Thread.sleep(100);
- verify(APP).forwardStatus(any());
- assertStatusWrittenToFileSystem(saveSinkFolder, statusResponseID);
- assertStatusWasLogged();
+ await().untilAsserted(() -> {
+ verify(APP).forwardStatus(any());
+ assertStatusWrittenToFileSystem(saveSinkFolder, statusResponseID);
+ });
// zusemsg sends async notification
var notificationResponseID = NotificationResponse.getResponseID(appDeliveryID);
@@ -176,10 +179,10 @@ public class ITEndToEndTest {
DELIVERY_SYSTEM, zsDeliveryID, appDeliveryID, GZ_WATERMARK, timestamp, timestamp
});
sendMsgResponse(notification);
- Thread.sleep(100);
- verify(APP).forwardNotification(any());
- assertStatusWrittenToFileSystem(saveSinkFolder, notificationResponseID);
- assertStatusWasLogged();
+ await().untilAsserted(() -> {
+ verify(APP).forwardNotification(any());
+ assertStatusWrittenToFileSystem(saveSinkFolder, notificationResponseID);
+ });
}
@@ -215,11 +218,6 @@ public class ITEndToEndTest {
}
}
- private void assertStatusWasLogged() {
- //todo
- }
-
-
private String formatFile(String templateFile, String... values) throws IOException {
var path = basePath + templateFile;
var templateString = FileUtils.readFileToString(new File(path), StandardCharsets.UTF_8);