Skip to content

Commit 92a1bdb

Browse files
gastaldimichalvavrik
authored andcommitted
Improve error handling in service discovery tests
- Replace `AssertionFailedError` with `fail` from JUnit across test files for consistency and clarity. - Enhance test failure messages with detailed error descriptions for better debugging.
1 parent 41d37a8 commit 92a1bdb

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

service-discovery/stork-custom/src/test/java/io/quarkus/ts/stork/custom/StorkCustomServiceDiscoveryAndLoadBalancerIT.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import static org.hamcrest.MatcherAssert.assertThat;
55
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
66
import static org.hamcrest.Matchers.is;
7+
import static org.junit.jupiter.api.Assertions.fail;
78

89
import java.io.IOException;
910
import java.net.ServerSocket;
@@ -20,8 +21,6 @@
2021
import io.quarkus.test.services.QuarkusApplication;
2122
import io.restassured.response.ValidatableResponse;
2223

23-
import junit.framework.AssertionFailedError;
24-
2524
@QuarkusScenario
2625
@Tag("QUARKUS-1413")
2726
public class StorkCustomServiceDiscoveryAndLoadBalancerIT {
@@ -82,7 +81,7 @@ protected static String getAvailablePort() {
8281
try (ServerSocket socket = new ServerSocket(0)) {
8382
return String.valueOf(socket.getLocalPort());
8483
} catch (IOException e) {
85-
throw new AssertionFailedError();
84+
fail("Unable to find available port", e);
8685
}
8786
}
8887
}

service-discovery/stork/src/test/java/io/quarkus/ts/stork/AbstractCommonTestCases.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.quarkus.ts.stork;
22

3+
import static org.junit.jupiter.api.Assertions.fail;
4+
35
import java.io.IOException;
46
import java.net.ServerSocket;
57

@@ -8,8 +10,6 @@
810
import io.quarkus.test.bootstrap.RestService;
911
import io.restassured.response.ValidatableResponse;
1012

11-
import junit.framework.AssertionFailedError;
12-
1313
public class AbstractCommonTestCases {
1414

1515
public static final String PREFIX = "ping-";
@@ -29,7 +29,7 @@ public static String getAvailablePort() {
2929
try (ServerSocket socket = new ServerSocket(0)) {
3030
return String.valueOf(socket.getLocalPort());
3131
} catch (IOException e) {
32-
throw new AssertionFailedError();
32+
fail("Unable to find available port", e);
3333
}
3434
}
3535
}

0 commit comments

Comments
 (0)