Skip to content

Commit 426fb5e

Browse files
committed
remove redundant AwaitUtils
1 parent 4e6b556 commit 426fb5e

3 files changed

Lines changed: 10 additions & 93 deletions

File tree

rlib-common/src/test/java/javasabr/rlib/common/util/AwaitUtilsTest.java

Lines changed: 0 additions & 48 deletions
This file was deleted.

rlib-common/src/testFixtures/java/javasabr/rlib/common/util/AwaitUtils.java

Lines changed: 0 additions & 38 deletions
This file was deleted.

rlib-network/src/test/java/javasabr/rlib/network/ConnectionCloseTest.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
import static javasabr.rlib.network.util.NetworkUtils.createAllTrustedClientSslContext;
44
import static javasabr.rlib.network.util.NetworkUtils.createSslContext;
55
import static org.assertj.core.api.Assertions.assertThat;
6+
import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively;
67

78
import java.net.InetSocketAddress;
9+
import java.time.Duration;
810
import java.util.concurrent.CountDownLatch;
911
import java.util.concurrent.TimeUnit;
10-
import javasabr.rlib.common.util.AwaitUtils;
1112
import javasabr.rlib.network.exception.ConnectionClosedException;
1213
import javasabr.rlib.network.impl.AbstractConnection;
1314
import javasabr.rlib.network.impl.DefaultConnection;
@@ -80,14 +81,16 @@ void shouldCloseServerConnectionWhenClientClosesTcpChannelAbruptly() {
8081

8182
// when
8283
clientConnection.channel().close();
83-
assertThat(AwaitUtils.await(5, TimeUnit.SECONDS, clientConnection::closed))
84-
.as("Client connection should be closed prior server side verification")
85-
.isTrue();
8684

8785
// then
88-
assertThat(AwaitUtils.await(5, TimeUnit.SECONDS, serverConnection::closed))
89-
.as("Server connection should be closed after receiving EOF from abruptly closed client channel")
90-
.isTrue();
86+
assertTimeoutPreemptively(
87+
Duration.ofSeconds(5),
88+
clientConnection::closed,
89+
"Client connection was not properly closed prior server side verification");
90+
assertTimeoutPreemptively(
91+
Duration.ofSeconds(5),
92+
serverConnection::closed,
93+
"Server connection was not closed after receiving EOF from abruptly closed client channel");
9194
}
9295
}
9396
}

0 commit comments

Comments
 (0)