[JAVA-31067] Fix integration jdk17 jersey tests: Assign random/available port to jersey server (#16135)

This commit is contained in:
panos-kakos 2024-03-18 21:06:12 +02:00 committed by GitHub
parent 68db1db5f0
commit be47444fcb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 1 deletions

View File

@ -104,7 +104,7 @@
</build>
<properties>
<jersey.version>3.1.1</jersey.version>
<jersey.version>3.1.5</jersey.version>
</properties>
</project>

View File

@ -41,6 +41,7 @@ public class StocksResourceIntegrationTest extends JerseyTest {
resourceConfig.register(IllegalArgumentExceptionMapper.class);
resourceConfig.register(ServerExceptionMapper.class);
resourceConfig.packages("com.baeldung.jersey.exceptionhandling.rest");
forceSet(TestProperties.CONTAINER_PORT, "0");
return resourceConfig;
}

View File

@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.TestProperties;
import org.junit.Test;
import jakarta.ws.rs.core.Application;
@ -15,6 +16,7 @@ public class GreetingsResourceIntegrationTest extends JerseyTest {
@Override
protected Application configure() {
forceSet(TestProperties.CONTAINER_PORT, "0");
return new ResourceConfig(Greetings.class);
}