From a8f68153fd18d92a477bab9a10cdf240c5264a68 Mon Sep 17 00:00:00 2001 From: Miguel Reboiro Jato Date: Fri, 22 Sep 2023 18:20:30 +0200 Subject: [PATCH] Fixes port already used in welcome test The use of RepeatedTest in the welcome test caused failures in some computers due to an insufficient time to close the port. This commit fixes this error by using a for to repeat the test, avoiding the creation of a new server in each repetition. --- .../esei/dai/hybridserver/week1/WelcomePageTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/test/java/es/uvigo/esei/dai/hybridserver/week1/WelcomePageTest.java b/src/test/java/es/uvigo/esei/dai/hybridserver/week1/WelcomePageTest.java index 5d5a5b0..c5f7879 100644 --- a/src/test/java/es/uvigo/esei/dai/hybridserver/week1/WelcomePageTest.java +++ b/src/test/java/es/uvigo/esei/dai/hybridserver/week1/WelcomePageTest.java @@ -23,14 +23,16 @@ import static org.hamcrest.MatcherAssert.assertThat; import java.io.IOException; -import org.junit.jupiter.api.RepeatedTest; +import org.junit.jupiter.api.Test; import es.uvigo.esei.dai.hybridserver.utils.HybridServerTestCase; public class WelcomePageTest extends HybridServerTestCase { - @RepeatedTest(10) + @Test public void testWelcome() throws IOException { - assertThat(getContentWithType(url, "text/html"), containsString("Hybrid Server")); + for (int i = 0; i < 10; i++) { + assertThat(getContentWithType(url, "text/html"), containsString("Hybrid Server")); + } } } -- 2.18.1