1616import org .elasticsearch .common .settings .Settings ;
1717import org .elasticsearch .common .transport .TransportAddress ;
1818import org .elasticsearch .transport .client .PreBuiltTransportClient ;
19- import org .junit .After ;
20- import org .junit .Test ;
19+ import org .junit .jupiter . api . AfterEach ;
20+ import org .junit .jupiter . api . Test ;
2121import org .testcontainers .DockerClientFactory ;
2222import org .testcontainers .containers .BindMode ;
2323import org .testcontainers .containers .wait .strategy .HttpWaitStrategy ;
3434import static org .assertj .core .api .Assertions .assertThat ;
3535import static org .assertj .core .api .Assertions .catchThrowable ;
3636
37- public class ElasticsearchContainerTest {
37+ class ElasticsearchContainerTest {
3838
3939 /**
4040 * Elasticsearch version which should be used for the Tests
@@ -59,7 +59,7 @@ public class ElasticsearchContainerTest {
5959
6060 private RestClient anonymousClient = null ;
6161
62- @ After
62+ @ AfterEach
6363 public void stopRestClient () throws IOException {
6464 if (client != null ) {
6565 client .close ();
@@ -74,7 +74,7 @@ public void stopRestClient() throws IOException {
7474 @ SuppressWarnings ("deprecation" ) // Using deprecated constructor for verification of backwards compatibility
7575 @ Test
7676 @ Deprecated // We will remove this test in the future
77- public void elasticsearchDeprecatedCtorTest () throws IOException {
77+ void elasticsearchDeprecatedCtorTest () throws IOException {
7878 // Create the elasticsearch container.
7979 try (
8080 ElasticsearchContainer container = new ElasticsearchContainer (ELASTICSEARCH_IMAGE ).withEnv ("foo" , "bar" ) // dummy env for compiler checking correct generics usage
@@ -96,7 +96,7 @@ public void elasticsearchDeprecatedCtorTest() throws IOException {
9696 }
9797
9898 @ Test
99- public void elasticsearchDefaultTest () throws IOException {
99+ void elasticsearchDefaultTest () throws IOException {
100100 // Create the elasticsearch container.
101101 try (
102102 ElasticsearchContainer container = new ElasticsearchContainer (ELASTICSEARCH_IMAGE ).withEnv ("foo" , "bar" ) // dummy env for compiler checking correct generics usage
@@ -118,7 +118,7 @@ public void elasticsearchDefaultTest() throws IOException {
118118 }
119119
120120 @ Test
121- public void elasticsearchSecuredTest () throws IOException {
121+ void elasticsearchSecuredTest () throws IOException {
122122 try (
123123 ElasticsearchContainer container = new ElasticsearchContainer (ELASTICSEARCH_IMAGE )
124124 .withPassword (ELASTICSEARCH_PASSWORD )
@@ -138,7 +138,7 @@ public void elasticsearchSecuredTest() throws IOException {
138138 }
139139
140140 @ Test
141- public void elasticsearchVersion () throws IOException {
141+ void elasticsearchVersion () throws IOException {
142142 try (ElasticsearchContainer container = new ElasticsearchContainer (ELASTICSEARCH_IMAGE )) {
143143 container .start ();
144144 Response response = getClient (container ).performRequest (new Request ("GET" , "/" ));
@@ -149,7 +149,7 @@ public void elasticsearchVersion() throws IOException {
149149 }
150150
151151 @ Test
152- public void elasticsearchVersion83 () throws IOException {
152+ void elasticsearchVersion83 () throws IOException {
153153 try (
154154 ElasticsearchContainer container = new ElasticsearchContainer (
155155 "docker.elastic.co/elasticsearch/elasticsearch:8.3.0"
@@ -163,7 +163,7 @@ public void elasticsearchVersion83() throws IOException {
163163 }
164164
165165 @ Test
166- public void elasticsearchOssImage () throws IOException {
166+ void elasticsearchOssImage () throws IOException {
167167 try (
168168 // ossContainer {
169169 ElasticsearchContainer container = new ElasticsearchContainer (
@@ -182,7 +182,7 @@ public void elasticsearchOssImage() throws IOException {
182182 }
183183
184184 @ Test
185- public void restClientClusterHealth () throws IOException {
185+ void restClientClusterHealth () throws IOException {
186186 // httpClientContainer7 {
187187 // Create the elasticsearch container.
188188 try (ElasticsearchContainer container = new ElasticsearchContainer (ELASTICSEARCH_IMAGE )) {
@@ -214,7 +214,7 @@ public void restClientClusterHealth() throws IOException {
214214 }
215215
216216 @ Test
217- public void restClientClusterHealthElasticsearch8 () throws IOException {
217+ void restClientClusterHealthElasticsearch8 () throws IOException {
218218 // httpClientContainer8 {
219219 // Create the elasticsearch container.
220220 try (
@@ -254,7 +254,7 @@ public void restClientClusterHealthElasticsearch8() throws IOException {
254254 }
255255
256256 @ Test
257- public void restClientClusterHealthElasticsearch8WithoutSSL () throws IOException {
257+ void restClientClusterHealthElasticsearch8WithoutSSL () throws IOException {
258258 // httpClientContainerNoSSL8 {
259259 // Create the elasticsearch container.
260260 try (
@@ -293,7 +293,7 @@ public void restClientClusterHealthElasticsearch8WithoutSSL() throws IOException
293293 }
294294
295295 @ Test
296- public void restClientSecuredClusterHealth () throws IOException {
296+ void restClientSecuredClusterHealth () throws IOException {
297297 // httpClientSecuredContainer {
298298 // Create the elasticsearch container.
299299 try (
@@ -330,7 +330,7 @@ public void restClientSecuredClusterHealth() throws IOException {
330330
331331 @ SuppressWarnings ("deprecation" ) // The TransportClient will be removed in Elasticsearch 8.
332332 @ Test
333- public void transportClientClusterHealth () {
333+ void transportClientClusterHealth () {
334334 // transportClientContainer {
335335 // Create the elasticsearch container.
336336 try (ElasticsearchContainer container = new ElasticsearchContainer (ELASTICSEARCH_IMAGE )) {
@@ -356,7 +356,7 @@ public void transportClientClusterHealth() {
356356 }
357357
358358 @ Test
359- public void incompatibleSettingsTest () {
359+ void incompatibleSettingsTest () {
360360 // The OSS image can not use security feature
361361 assertThat (
362362 catchThrowable (() -> {
@@ -369,7 +369,7 @@ public void incompatibleSettingsTest() {
369369 }
370370
371371 @ Test
372- public void testDockerHubElasticsearch8ImageSecureByDefault () throws Exception {
372+ void testDockerHubElasticsearch8ImageSecureByDefault () throws Exception {
373373 try (ElasticsearchContainer container = new ElasticsearchContainer ("elasticsearch:8.1.2" )) {
374374 container .start ();
375375
@@ -378,7 +378,7 @@ public void testDockerHubElasticsearch8ImageSecureByDefault() throws Exception {
378378 }
379379
380380 @ Test
381- public void testElasticsearch8SecureByDefaultCustomCaCertFails () throws Exception {
381+ void testElasticsearch8SecureByDefaultCustomCaCertFails () throws Exception {
382382 final MountableFile mountableFile = MountableFile .forClasspathResource ("http_ca.crt" );
383383 String caPath = "/tmp/http_ca.crt" ;
384384 try (
@@ -400,7 +400,7 @@ public void testElasticsearch8SecureByDefaultCustomCaCertFails() throws Exceptio
400400 }
401401
402402 @ Test
403- public void testElasticsearch8SecureByDefaultHttpWaitStrategy () throws Exception {
403+ void testElasticsearch8SecureByDefaultHttpWaitStrategy () throws Exception {
404404 final HttpWaitStrategy httpsWaitStrategy = Wait
405405 .forHttps ("/" )
406406 .forPort (9200 )
@@ -423,7 +423,7 @@ public void testElasticsearch8SecureByDefaultHttpWaitStrategy() throws Exception
423423 }
424424
425425 @ Test
426- public void testElasticsearch8SecureByDefaultFailsSilentlyOnLatestImages () throws Exception {
426+ void testElasticsearch8SecureByDefaultFailsSilentlyOnLatestImages () throws Exception {
427427 // this test exists for custom images by users that use the `latest` tag
428428 // even though the version might be older than version 8
429429 // this tags an old 7.x version as :latest
@@ -442,7 +442,7 @@ public void testElasticsearch8SecureByDefaultFailsSilentlyOnLatestImages() throw
442442 }
443443
444444 @ Test
445- public void testElasticsearch7CanHaveSecurityEnabledAndUseSslContext () throws Exception {
445+ void testElasticsearch7CanHaveSecurityEnabledAndUseSslContext () throws Exception {
446446 String customizedCertPath = "/usr/share/elasticsearch/config/certs/http_ca_customized.crt" ;
447447 try (
448448 ElasticsearchContainer container = new ElasticsearchContainer (
@@ -485,7 +485,7 @@ public void testElasticsearch7CanHaveSecurityEnabledAndUseSslContext() throws Ex
485485 }
486486
487487 @ Test
488- public void testElasticsearchDefaultMaxHeapSize () throws Exception {
488+ void testElasticsearchDefaultMaxHeapSize () throws Exception {
489489 long defaultHeapSize = 2147483648L ;
490490
491491 try (ElasticsearchContainer container = new ElasticsearchContainer (ELASTICSEARCH_IMAGE )) {
@@ -495,7 +495,7 @@ public void testElasticsearchDefaultMaxHeapSize() throws Exception {
495495 }
496496
497497 @ Test
498- public void testElasticsearchCustomMaxHeapSizeInEnvironmentVariable () throws Exception {
498+ void testElasticsearchCustomMaxHeapSizeInEnvironmentVariable () throws Exception {
499499 long customHeapSize = 1574961152 ;
500500
501501 try (
@@ -508,7 +508,7 @@ public void testElasticsearchCustomMaxHeapSizeInEnvironmentVariable() throws Exc
508508 }
509509
510510 @ Test
511- public void testElasticsearchCustomMaxHeapSizeInJvmOptionsFile () throws Exception {
511+ void testElasticsearchCustomMaxHeapSizeInJvmOptionsFile () throws Exception {
512512 long customHeapSize = 1574961152 ;
513513
514514 try (
0 commit comments