From 4d2403d619437a1fea8bfa8607dab7aae1fce196 Mon Sep 17 00:00:00 2001 From: Chris Eager Date: Tue, 30 Nov 2021 15:30:46 -0800 Subject: [PATCH] Use `assertTimeoutPreemptively` instead of `assertTimeout` --- .../storage/MessagePersisterIntegrationTest.java | 4 ++-- .../websocket/WebSocketConnectionIntegrationTest.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/storage/MessagePersisterIntegrationTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/storage/MessagePersisterIntegrationTest.java index 0e78bd3d5..580da9b52 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/storage/MessagePersisterIntegrationTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/storage/MessagePersisterIntegrationTest.java @@ -6,7 +6,7 @@ package org.whispersystems.textsecuregcm.storage; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTimeout; +import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -101,7 +101,7 @@ class MessagePersisterIntegrationTest { final List expectedMessages = new ArrayList<>(messageCount); final Instant now = Instant.now(); - assertTimeout(Duration.ofSeconds(15), () -> { + assertTimeoutPreemptively(Duration.ofSeconds(15), () -> { for (int i = 0; i < messageCount; i++) { final UUID messageGuid = UUID.randomUUID(); diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/websocket/WebSocketConnectionIntegrationTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/websocket/WebSocketConnectionIntegrationTest.java index 5d1d1e70b..6071d24cf 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/websocket/WebSocketConnectionIntegrationTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/websocket/WebSocketConnectionIntegrationTest.java @@ -6,7 +6,7 @@ package org.whispersystems.textsecuregcm.websocket; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTimeout; +import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.ArgumentMatchers.any; @@ -122,7 +122,7 @@ class WebSocketConnectionIntegrationTest { final List expectedMessages = new ArrayList<>(persistedMessageCount + cachedMessageCount); - assertTimeout(Duration.ofSeconds(15), () -> { + assertTimeoutPreemptively(Duration.ofSeconds(15), () -> { { final List persistedMessages = new ArrayList<>(persistedMessageCount); @@ -200,7 +200,7 @@ class WebSocketConnectionIntegrationTest { final List expectedMessages = new ArrayList<>(persistedMessageCount + cachedMessageCount); - assertTimeout(Duration.ofSeconds(15), () -> { + assertTimeoutPreemptively(Duration.ofSeconds(15), () -> { { final List persistedMessages = new ArrayList<>(persistedMessageCount);