Source:
<code>public void shouldCreateRabbitMQContainer() { <START> RabbitMQContainer container = new RabbitMQContainer(); <END> assertThat(container.getDockerImageName()).isEqualTo("rabbitmq:" + DEFAULT_TAG); assertThat(container.getAdminPassword()).isEqualTo("guest"); assertThat(container.getAdminUsername()).isEqualTo("guest"); container.start(); container.waitUntilContainerStarted(); assertThat(container.getAmqpsUrl()).isEqualTo( String.format("amqps://%s:%d", container.getContainerIpAddress(), container.getMappedPort(DEFAULT_AMQPS_PORT))); assertThat(container.getAmqpUrl()).isEqualTo( String.format("amqp://%s:%d", container.getContainerIpAddress(), container.getMappedPort(DEFAULT_AMQP_PORT))); assertThat(container.getHttpsUrl()).isEqualTo( String.format("https://%s:%d", container.getContainerIpAddress(), container.getMappedPort(DEFAULT_HTTPS_PORT))); assertThat(container.getHttpUrl()).isEqualTo( String.format("http://%s:%d", container.getContainerIpAddress(), container.getMappedPort(DEFAULT_HTTP_PORT))); assertThat(container.getHttpsPort()).isEqualTo(container.getMappedPort(DEFAULT_HTTPS_PORT)); assertThat(container.getHttpPort()).isEqualTo(container.getMappedPort(DEFAULT_HTTP_PORT)); assertThat(container.getAmqpsPort()).isEqualTo(container.getMappedPort(DEFAULT_AMQPS_PORT)); assertThat(container.getAmqpPort()).isEqualTo(container.getMappedPort(DEFAULT_AMQP_PORT)); assertThat(container.getLivenessCheckPortNumbers()).containsExactlyInAnyOrder( container.getMappedPort(DEFAULT_AMQP_PORT), container.getMappedPort(DEFAULT_AMQPS_PORT), container.getMappedPort(DEFAULT_HTTP_PORT), container.getMappedPort(DEFAULT_HTTPS_PORT) ); }</code><technical_language>please try-with-resources (see other tests for reference)</technical_language>

Target:
public void shouldCreateRabbitMQContainer() { try (RabbitMQContainer container = new RabbitMQContainer()) { assertThat(container.getDockerImageName()).isEqualTo(DEFAULT_IMAGE); assertThat(container.getAdminPassword()).isEqualTo("guest"); assertThat(container.getAdminUsername()).isEqualTo("guest"); container.start(); assertThat(container.getAmqpsUrl()).isEqualTo( String.format("amqps://%s:%d", container.getContainerIpAddress(), container.getMappedPort(DEFAULT_AMQPS_PORT))); assertThat(container.getAmqpUrl()).isEqualTo( String.format("amqp://%s:%d", container.getContainerIpAddress(), container.getMappedPort(DEFAULT_AMQP_PORT))); assertThat(container.getHttpsUrl()).isEqualTo( String.format("https://%s:%d", container.getContainerIpAddress(), container.getMappedPort(DEFAULT_HTTPS_PORT))); assertThat(container.getHttpUrl()).isEqualTo( String.format("http://%s:%d", container.getContainerIpAddress(), container.getMappedPort(DEFAULT_HTTP_PORT))); assertThat(container.getHttpsPort()).isEqualTo(container.getMappedPort(DEFAULT_HTTPS_PORT)); assertThat(container.getHttpPort()).isEqualTo(container.getMappedPort(DEFAULT_HTTP_PORT)); assertThat(container.getAmqpsPort()).isEqualTo(container.getMappedPort(DEFAULT_AMQPS_PORT)); assertThat(container.getAmqpPort()).isEqualTo(container.getMappedPort(DEFAULT_AMQP_PORT)); assertThat(container.getLivenessCheckPortNumbers()).containsExactlyInAnyOrder( container.getMappedPort(DEFAULT_AMQP_PORT), container.getMappedPort(DEFAULT_AMQPS_PORT), container.getMappedPort(DEFAULT_HTTP_PORT), container.getMappedPort(DEFAULT_HTTPS_PORT) ); } }