Skip to content

Commit bad1441

Browse files
committed
Remove unnecessary public access modifiers from junit5 tests
1 parent ceb3e68 commit bad1441

File tree

13 files changed

+41
-41
lines changed

13 files changed

+41
-41
lines changed

examples/hazelcast/src/test/java/org/testcontainers/examples/HazelcastTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/**
1919
* Examples with Hazelcast using both a single container and a cluster with two containers.
2020
*/
21-
public class HazelcastTest {
21+
class HazelcastTest {
2222

2323
// Hazelcast values
2424
private static final String HZ_IMAGE_NAME = "hazelcast/hazelcast:5.2.0";
@@ -47,12 +47,12 @@ public class HazelcastTest {
4747
private static final String TRUE_VALUE = "true";
4848

4949
@AfterEach
50-
public void cleanUp() {
50+
void cleanUp() {
5151
HazelcastClient.shutdownAll();
5252
}
5353

5454
@Test
55-
public void singleHazelcastContainer() {
55+
void singleHazelcastContainer() {
5656
try (
5757
GenericContainer<?> container = new GenericContainer<>(DockerImageName.parse(HZ_IMAGE_NAME))
5858
.withExposedPorts(DEFAULT_EXPOSED_PORT)
@@ -76,7 +76,7 @@ public void singleHazelcastContainer() {
7676
}
7777

7878
@Test
79-
public void hazelcastCluster() {
79+
void hazelcastCluster() {
8080
Network network = Network.newNetwork();
8181
try (
8282
GenericContainer<?> container1 = new GenericContainer<>(DockerImageName.parse(HZ_IMAGE_NAME))

examples/immudb/src/test/java/ImmuDbTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Test class for the ImmuDbClient.
1717
*/
1818
@Testcontainers
19-
public class ImmuDbTest {
19+
class ImmuDbTest {
2020

2121
// Default port for the ImmuDb server
2222
private static final int IMMUDB_PORT = 3322;
@@ -40,7 +40,7 @@ public class ImmuDbTest {
4040
private ImmuClient immuClient;
4141

4242
@BeforeEach
43-
public void setUp() {
43+
void setUp() {
4444
this.immuClient =
4545
ImmuClient
4646
.newBuilder()
@@ -51,12 +51,12 @@ public void setUp() {
5151
}
5252

5353
@AfterEach
54-
public void tearDown() {
54+
void tearDown() {
5555
this.immuClient.closeSession();
5656
}
5757

5858
@Test
59-
public void testGetValue() {
59+
void testGetValue() {
6060
try {
6161
immuClient.set("test1", "test2".getBytes());
6262

examples/kafka-cluster/src/test/java/com/example/kafkacluster/KafkaContainerClusterTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
import static org.assertj.core.api.Assertions.assertThat;
2626
import static org.assertj.core.api.Assertions.tuple;
2727

28-
public class KafkaContainerClusterTest {
28+
class KafkaContainerClusterTest {
2929

3030
@Test
31-
public void testKafkaContainerCluster() throws Exception {
31+
void testKafkaContainerCluster() throws Exception {
3232
try (KafkaContainerCluster cluster = new KafkaContainerCluster("6.2.1", 3, 2)) {
3333
cluster.start();
3434
String bootstrapServers = cluster.getBootstrapServers();
@@ -40,7 +40,7 @@ public void testKafkaContainerCluster() throws Exception {
4040
}
4141

4242
@Test
43-
public void testKafkaContainerKraftCluster() throws Exception {
43+
void testKafkaContainerKraftCluster() throws Exception {
4444
try (KafkaContainerKraftCluster cluster = new KafkaContainerKraftCluster("7.0.0", 3, 2)) {
4545
cluster.start();
4646
String bootstrapServers = cluster.getBootstrapServers();
@@ -52,7 +52,7 @@ public void testKafkaContainerKraftCluster() throws Exception {
5252
}
5353

5454
@Test
55-
public void testKafkaContainerKraftClusterAfterConfluentPlatform740() throws Exception {
55+
void testKafkaContainerKraftClusterAfterConfluentPlatform740() throws Exception {
5656
try (KafkaContainerKraftCluster cluster = new KafkaContainerKraftCluster("7.4.0", 3, 2)) {
5757
cluster.start();
5858
String bootstrapServers = cluster.getBootstrapServers();

examples/nats/src/test/java/com/example/NatsContainerTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515

1616
import static org.assertj.core.api.Assertions.assertThat;
1717

18-
public class NatsContainerTest {
18+
class NatsContainerTest {
1919

2020
public static final Integer NATS_PORT = 4222;
2121

2222
public static final Integer NATS_MGMT_PORT = 8222;
2323

2424
@Test
25-
public void test() throws IOException, InterruptedException {
25+
void test() throws IOException, InterruptedException {
2626
try (
2727
GenericContainer<?> nats = new GenericContainer<>("nats:2.9.8-alpine3.16")
2828
.withExposedPorts(NATS_PORT, NATS_MGMT_PORT)
@@ -38,7 +38,7 @@ public void test() throws IOException, InterruptedException {
3838
}
3939

4040
@Test
41-
public void testServerStatus() throws IOException {
41+
void testServerStatus() throws IOException {
4242
try (
4343
GenericContainer<?> nats = new GenericContainer<>("nats:2.9.8-alpine3.16")
4444
.withExposedPorts(NATS_PORT, NATS_MGMT_PORT)

examples/redis-backed-cache/src/test/java/RedisBackedCacheTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Integration test for Redis-backed cache implementation.
1717
*/
1818
@Testcontainers
19-
public class RedisBackedCacheTest {
19+
class RedisBackedCacheTest {
2020

2121
@Container
2222
public GenericContainer<?> redis = new GenericContainer<>(DockerImageName.parse("redis:3.0.6"))
@@ -25,14 +25,14 @@ public class RedisBackedCacheTest {
2525
private Cache cache;
2626

2727
@BeforeEach
28-
public void setUp() throws Exception {
28+
void setUp() throws Exception {
2929
Jedis jedis = new Jedis(redis.getHost(), redis.getMappedPort(6379));
3030

3131
cache = new RedisBackedCache(jedis, "test");
3232
}
3333

3434
@Test
35-
public void testFindingAnInsertedValue() {
35+
void testFindingAnInsertedValue() {
3636
cache.put("foo", "FOO");
3737
Optional<String> foundObject = cache.get("foo", String.class);
3838

@@ -43,7 +43,7 @@ public void testFindingAnInsertedValue() {
4343
}
4444

4545
@Test
46-
public void testNotFindingAValueThatWasNotInserted() {
46+
void testNotFindingAValueThatWasNotInserted() {
4747
Optional<String> foundObject = cache.get("bar", String.class);
4848

4949
assertThat(foundObject.isPresent())

examples/selenium-container/src/test/java/SeleniumContainerTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
@ExtendWith(SpringExtension.class)
3232
@SpringBootTest(classes = DemoApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
3333
@ContextConfiguration(initializers = SeleniumContainerTest.Initializer.class)
34-
public class SeleniumContainerTest {
34+
class SeleniumContainerTest {
3535

3636
@LocalServerPort
3737
private int port;
@@ -42,7 +42,7 @@ public class SeleniumContainerTest {
4242
.withRecordingMode(VncRecordingMode.RECORD_ALL, new File("build"));
4343

4444
@Test
45-
public void simplePlainSeleniumTest() {
45+
void simplePlainSeleniumTest() {
4646
RemoteWebDriver driver = new RemoteWebDriver(chrome.getSeleniumAddress(), new ChromeOptions());
4747
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(30));
4848

@@ -52,7 +52,7 @@ public void simplePlainSeleniumTest() {
5252
assertThat(hElement).as("The h element is found").isNotEmpty();
5353
}
5454

55-
public static class Initializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
55+
static class Initializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
5656

5757
@Override
5858
public void initialize(ConfigurableApplicationContext applicationContext) {

examples/sftp/src/test/java/org/example/SftpContainerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
import static org.assertj.core.api.Assertions.assertThat;
1616

17-
public class SftpContainerTest {
17+
class SftpContainerTest {
1818

1919
@Test
20-
public void test() throws Exception {
20+
void test() throws Exception {
2121
try (
2222
GenericContainer<?> sftp = new GenericContainer<>("atmoz/sftp:alpine-3.7")
2323
.withCopyFileToContainer(

examples/singleton-container/src/test/java/com/example/BarConcreteTestClass.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010

1111
import static org.assertj.core.api.Assertions.assertThat;
1212

13-
public class BarConcreteTestClass extends AbstractIntegrationTest {
13+
class BarConcreteTestClass extends AbstractIntegrationTest {
1414

1515
private Cache cache;
1616

1717
@BeforeEach
18-
public void setUp() {
18+
void setUp() {
1919
Jedis jedis = new Jedis(redis.getHost(), redis.getMappedPort(6379));
2020

2121
cache = new RedisBackedCache(jedis, "bar");
2222
}
2323

2424
@Test
25-
public void testInsertValue() {
25+
void testInsertValue() {
2626
cache.put("bar", "BAR");
2727
Optional<String> foundObject = cache.get("bar", String.class);
2828

examples/singleton-container/src/test/java/com/example/FooConcreteTestClass.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010

1111
import static org.assertj.core.api.Assertions.assertThat;
1212

13-
public class FooConcreteTestClass extends AbstractIntegrationTest {
13+
class FooConcreteTestClass extends AbstractIntegrationTest {
1414

1515
private Cache cache;
1616

1717
@BeforeEach
18-
public void setUp() {
18+
void setUp() {
1919
Jedis jedis = new Jedis(redis.getHost(), redis.getMappedPort(6379));
2020

2121
cache = new RedisBackedCache(jedis, "foo");
2222
}
2323

2424
@Test
25-
public void testInsertValue() {
25+
void testInsertValue() {
2626
cache.put("foo", "FOO");
2727
Optional<String> foundObject = cache.get("foo", String.class);
2828

examples/solr-container/src/test/java/com/example/SolrQueryTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import static org.assertj.core.api.Assertions.assertThat;
1919

20-
public class SolrQueryTest {
20+
class SolrQueryTest {
2121

2222
private static final DockerImageName SOLR_IMAGE = DockerImageName.parse("solr:8.3.0");
2323

@@ -27,7 +27,7 @@ public class SolrQueryTest {
2727
private static SolrClient solrClient;
2828

2929
@BeforeAll
30-
public static void setUp() throws IOException, SolrServerException {
30+
static void setUp() throws IOException, SolrServerException {
3131
solrContainer.start();
3232
solrClient =
3333
new Http2SolrClient.Builder(
@@ -63,7 +63,7 @@ public static void setUp() throws IOException, SolrServerException {
6363
}
6464

6565
@Test
66-
public void testQueryForShoes() {
66+
void testQueryForShoes() {
6767
SolrSearchEngine searchEngine = new SolrSearchEngine(solrClient);
6868

6969
SearchResult result = searchEngine.search("shoes");
@@ -72,7 +72,7 @@ public void testQueryForShoes() {
7272
}
7373

7474
@Test
75-
public void testQueryForTShirt() {
75+
void testQueryForTShirt() {
7676
SolrSearchEngine searchEngine = new SolrSearchEngine(solrClient);
7777

7878
SearchResult result = searchEngine.search("t-shirt");
@@ -81,7 +81,7 @@ public void testQueryForTShirt() {
8181
}
8282

8383
@Test
84-
public void testQueryForAsterisk() {
84+
void testQueryForAsterisk() {
8585
SolrSearchEngine searchEngine = new SolrSearchEngine(solrClient);
8686

8787
SearchResult result = searchEngine.search("*");

0 commit comments

Comments
 (0)