Skip to content

Commit

Permalink
Remove unnecessary public access modifiers from junit5 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
samed-bicer committed Aug 24, 2023
1 parent ceb3e68 commit bad1441
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* Examples with Hazelcast using both a single container and a cluster with two containers.
*/
public class HazelcastTest {
class HazelcastTest {

// Hazelcast values
private static final String HZ_IMAGE_NAME = "hazelcast/hazelcast:5.2.0";
Expand Down Expand Up @@ -47,12 +47,12 @@ public class HazelcastTest {
private static final String TRUE_VALUE = "true";

@AfterEach
public void cleanUp() {
void cleanUp() {
HazelcastClient.shutdownAll();
}

@Test
public void singleHazelcastContainer() {
void singleHazelcastContainer() {
try (
GenericContainer<?> container = new GenericContainer<>(DockerImageName.parse(HZ_IMAGE_NAME))
.withExposedPorts(DEFAULT_EXPOSED_PORT)
Expand All @@ -76,7 +76,7 @@ public void singleHazelcastContainer() {
}

@Test
public void hazelcastCluster() {
void hazelcastCluster() {
Network network = Network.newNetwork();
try (
GenericContainer<?> container1 = new GenericContainer<>(DockerImageName.parse(HZ_IMAGE_NAME))
Expand Down
8 changes: 4 additions & 4 deletions examples/immudb/src/test/java/ImmuDbTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Test class for the ImmuDbClient.
*/
@Testcontainers
public class ImmuDbTest {
class ImmuDbTest {

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

@BeforeEach
public void setUp() {
void setUp() {
this.immuClient =
ImmuClient
.newBuilder()
Expand All @@ -51,12 +51,12 @@ public void setUp() {
}

@AfterEach
public void tearDown() {
void tearDown() {
this.immuClient.closeSession();
}

@Test
public void testGetValue() {
void testGetValue() {
try {
immuClient.set("test1", "test2".getBytes());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;

public class KafkaContainerClusterTest {
class KafkaContainerClusterTest {

@Test
public void testKafkaContainerCluster() throws Exception {
void testKafkaContainerCluster() throws Exception {
try (KafkaContainerCluster cluster = new KafkaContainerCluster("6.2.1", 3, 2)) {
cluster.start();
String bootstrapServers = cluster.getBootstrapServers();
Expand All @@ -40,7 +40,7 @@ public void testKafkaContainerCluster() throws Exception {
}

@Test
public void testKafkaContainerKraftCluster() throws Exception {
void testKafkaContainerKraftCluster() throws Exception {
try (KafkaContainerKraftCluster cluster = new KafkaContainerKraftCluster("7.0.0", 3, 2)) {
cluster.start();
String bootstrapServers = cluster.getBootstrapServers();
Expand All @@ -52,7 +52,7 @@ public void testKafkaContainerKraftCluster() throws Exception {
}

@Test
public void testKafkaContainerKraftClusterAfterConfluentPlatform740() throws Exception {
void testKafkaContainerKraftClusterAfterConfluentPlatform740() throws Exception {
try (KafkaContainerKraftCluster cluster = new KafkaContainerKraftCluster("7.4.0", 3, 2)) {
cluster.start();
String bootstrapServers = cluster.getBootstrapServers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

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

public class NatsContainerTest {
class NatsContainerTest {

public static final Integer NATS_PORT = 4222;

public static final Integer NATS_MGMT_PORT = 8222;

@Test
public void test() throws IOException, InterruptedException {
void test() throws IOException, InterruptedException {
try (
GenericContainer<?> nats = new GenericContainer<>("nats:2.9.8-alpine3.16")
.withExposedPorts(NATS_PORT, NATS_MGMT_PORT)
Expand All @@ -38,7 +38,7 @@ public void test() throws IOException, InterruptedException {
}

@Test
public void testServerStatus() throws IOException {
void testServerStatus() throws IOException {
try (
GenericContainer<?> nats = new GenericContainer<>("nats:2.9.8-alpine3.16")
.withExposedPorts(NATS_PORT, NATS_MGMT_PORT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Integration test for Redis-backed cache implementation.
*/
@Testcontainers
public class RedisBackedCacheTest {
class RedisBackedCacheTest {

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

@BeforeEach
public void setUp() throws Exception {
void setUp() throws Exception {
Jedis jedis = new Jedis(redis.getHost(), redis.getMappedPort(6379));

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

@Test
public void testFindingAnInsertedValue() {
void testFindingAnInsertedValue() {
cache.put("foo", "FOO");
Optional<String> foundObject = cache.get("foo", String.class);

Expand All @@ -43,7 +43,7 @@ public void testFindingAnInsertedValue() {
}

@Test
public void testNotFindingAValueThatWasNotInserted() {
void testNotFindingAValueThatWasNotInserted() {
Optional<String> foundObject = cache.get("bar", String.class);

assertThat(foundObject.isPresent())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@ExtendWith(SpringExtension.class)
@SpringBootTest(classes = DemoApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ContextConfiguration(initializers = SeleniumContainerTest.Initializer.class)
public class SeleniumContainerTest {
class SeleniumContainerTest {

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

@Test
public void simplePlainSeleniumTest() {
void simplePlainSeleniumTest() {
RemoteWebDriver driver = new RemoteWebDriver(chrome.getSeleniumAddress(), new ChromeOptions());
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(30));

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

public static class Initializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
static class Initializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {

@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

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

public class SftpContainerTest {
class SftpContainerTest {

@Test
public void test() throws Exception {
void test() throws Exception {
try (
GenericContainer<?> sftp = new GenericContainer<>("atmoz/sftp:alpine-3.7")
.withCopyFileToContainer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@

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

public class BarConcreteTestClass extends AbstractIntegrationTest {
class BarConcreteTestClass extends AbstractIntegrationTest {

private Cache cache;

@BeforeEach
public void setUp() {
void setUp() {
Jedis jedis = new Jedis(redis.getHost(), redis.getMappedPort(6379));

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

@Test
public void testInsertValue() {
void testInsertValue() {
cache.put("bar", "BAR");
Optional<String> foundObject = cache.get("bar", String.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@

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

public class FooConcreteTestClass extends AbstractIntegrationTest {
class FooConcreteTestClass extends AbstractIntegrationTest {

private Cache cache;

@BeforeEach
public void setUp() {
void setUp() {
Jedis jedis = new Jedis(redis.getHost(), redis.getMappedPort(6379));

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

@Test
public void testInsertValue() {
void testInsertValue() {
cache.put("foo", "FOO");
Optional<String> foundObject = cache.get("foo", String.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

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

public class SolrQueryTest {
class SolrQueryTest {

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

Expand All @@ -27,7 +27,7 @@ public class SolrQueryTest {
private static SolrClient solrClient;

@BeforeAll
public static void setUp() throws IOException, SolrServerException {
static void setUp() throws IOException, SolrServerException {
solrContainer.start();
solrClient =
new Http2SolrClient.Builder(
Expand Down Expand Up @@ -63,7 +63,7 @@ public static void setUp() throws IOException, SolrServerException {
}

@Test
public void testQueryForShoes() {
void testQueryForShoes() {
SolrSearchEngine searchEngine = new SolrSearchEngine(solrClient);

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

@Test
public void testQueryForTShirt() {
void testQueryForTShirt() {
SolrSearchEngine searchEngine = new SolrSearchEngine(solrClient);

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

@Test
public void testQueryForAsterisk() {
void testQueryForAsterisk() {
SolrSearchEngine searchEngine = new SolrSearchEngine(solrClient);

SearchResult result = searchEngine.search("*");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
properties = { "spring.datasource.url=jdbc:tc:postgresql:11-alpine:///databasename" }
)
@ActiveProfiles("test")
public abstract class AbstractIntegrationTest {
abstract class AbstractIntegrationTest {

static GenericContainer<?> redis = new GenericContainer<>(DockerImageName.parse("redis:3-alpine"))
.withExposedPorts(6379);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

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

public class DemoControllerTest extends AbstractIntegrationTest {
class DemoControllerTest extends AbstractIntegrationTest {

@Autowired
TestRestTemplate restTemplate;
Expand All @@ -15,7 +15,7 @@ public class DemoControllerTest extends AbstractIntegrationTest {
DemoRepository demoRepository;

@Test
public void simpleTest() {
void simpleTest() {
String fooResource = "/foo";

restTemplate.put(fooResource, "bar");
Expand All @@ -24,7 +24,7 @@ public void simpleTest() {
}

@Test
public void simpleJPATest() {
void simpleJPATest() {
DemoEntity demoEntity = new DemoEntity();
demoEntity.setValue("Some value");
demoRepository.save(demoEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

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

public class ZookeeperContainerTest {
class ZookeeperContainerTest {

private static final int ZOOKEEPER_PORT = 2181;

@Test
public void test() throws Exception {
void test() throws Exception {
String path = "/messages/zk-tc";
String content = "Running Zookeeper with Testcontainers";
try (
Expand Down

0 comments on commit bad1441

Please sign in to comment.