From 90984bf5af4cc39e74e3144325d0f1709901cf5c Mon Sep 17 00:00:00 2001 From: Rian-Ismael <106334437+Rian-Ismael@users.noreply.github.com> Date: Thu, 30 Jan 2025 23:56:51 -0300 Subject: [PATCH] Update ExposedHostTest.java Improves the readability of the test. Numeric literals in assertions have been replaced with descriptive constants, improving readability and making the test easier to understand, modify, and debugging efficiency. --- .../testcontainers/containers/ExposedHostTest.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/core/src/test/java/org/testcontainers/containers/ExposedHostTest.java b/core/src/test/java/org/testcontainers/containers/ExposedHostTest.java index 4ce316fcf80..9a6a69ccfac 100644 --- a/core/src/test/java/org/testcontainers/containers/ExposedHostTest.java +++ b/core/src/test/java/org/testcontainers/containers/ExposedHostTest.java @@ -25,6 +25,10 @@ public class ExposedHostTest { + private static final int FIXED_PORT_80 = 80; + + private static final int FIXED_PORT_81 = 81; + private static HttpServer server; @BeforeClass @@ -82,11 +86,11 @@ public void testExposedHostWithNetwork() { @Test public void testExposedHostPortOnFixedInternalPorts() { - Testcontainers.exposeHostPorts(ImmutableMap.of(server.getAddress().getPort(), 80)); - Testcontainers.exposeHostPorts(ImmutableMap.of(server.getAddress().getPort(), 81)); - - assertResponse(new GenericContainer<>(tinyContainerDef()), 80); - assertResponse(new GenericContainer<>(tinyContainerDef()), 81); + Testcontainers.exposeHostPorts(ImmutableMap.of(server.getAddress().getPort(), FIXED_PORT_80)); + Testcontainers.exposeHostPorts(ImmutableMap.of(server.getAddress().getPort(), FIXED_PORT_81)); + + assertResponse(new GenericContainer<>(tinyContainerDef()), FIXED_PORT_80); + assertResponse(new GenericContainer<>(tinyContainerDef()), FIXED_PORT_81); } @Test