@Test
    public void addingExposedPortTwiceShouldNotFail() {
        redis.addExposedPort(8987);
        redis.addExposedPort(8987);
        assertThat(redis.getExposedPorts()).as("Both ports should be exposed").hasSize(2); // 2 ports = de-duplicated port 8897 and original port 6379
        assertThat(redis.getExposedPorts()).as("withExposedPort should be exposed").contains(REDIS_PORT);
        assertThat(redis.getExposedPorts()).as("addExposedPort should be exposed").contains(8987);
    }
Create a container with an extra host entry and expose the content of /etc/hosts for testing.
core/src/test/java/org/testcontainers/junit/GenericContainerRuleTest.java