aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-08-20 13:02:03 +0200
committerChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-08-20 13:02:03 +0200
commit5d125d6167a57517296c8c8ea5bdd2366b9f9191 (patch)
tree1fc9b9f654fdd63756ad749facd5f13bf7ca74b3 /src/test
parent2b8a7df25878f546ace25373f44baeb026cf6d2b (diff)
downloadmoa-zs-5d125d6167a57517296c8c8ea5bdd2366b9f9191.tar.gz
moa-zs-5d125d6167a57517296c8c8ea5bdd2366b9f9191.tar.bz2
moa-zs-5d125d6167a57517296c8c8ea5bdd2366b9f9191.zip
Replace Thread.sleep with Await
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);