Skip to content

Commit eea6913

Browse files
author
eugenp
committed
general cleanup work
1 parent 3c478d0 commit eea6913

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

core-java-8/src/test/java/org/baeldung/java8/JavaTryWithResourcesTest.java

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,24 @@ public class JavaTryWithResourcesTest {
1313
private static final String TEST_STRING_HELLO_WORLD = "Hello World";
1414
private Date resource1Date, resource2Date;
1515

16-
/*
17-
* Example for using Try_with_resources
18-
*/
16+
// tests
17+
18+
/* Example for using Try_with_resources */
1919
@Test
2020
public void whenWritingToStringWriter_thenCorrectlyWritten() {
21-
22-
StringWriter sw = new StringWriter();
21+
final StringWriter sw = new StringWriter();
2322
try (PrintWriter pw = new PrintWriter(sw, true)) {
2423
pw.print(TEST_STRING_HELLO_WORLD);
2524
}
2625

2726
Assert.assertEquals(sw.getBuffer().toString(), TEST_STRING_HELLO_WORLD);
2827
}
2928

30-
/*
31-
* Example for using multiple resources
32-
*/
29+
/* Example for using multiple resources */
3330
@Test
3431
public void givenStringToScanner_whenWritingToStringWriter_thenCorrectlyWritten() {
3532

36-
StringWriter sw = new StringWriter();
33+
final StringWriter sw = new StringWriter();
3734
try (Scanner sc = new Scanner(TEST_STRING_HELLO_WORLD); PrintWriter pw = new PrintWriter(sw, true)) {
3835
while (sc.hasNext()) {
3936
pw.print(sc.nextLine());
@@ -43,12 +40,9 @@ public void givenStringToScanner_whenWritingToStringWriter_thenCorrectlyWritten(
4340
Assert.assertEquals(sw.getBuffer().toString(), TEST_STRING_HELLO_WORLD);
4441
}
4542

46-
/*
47-
* Example to show order in which the resources are closed
48-
*/
43+
/* Example to show order in which the resources are closed */
4944
@Test
5045
public void whenFirstAutoClosableResourceIsinitializedFirst_thenFirstAutoClosableResourceIsReleasedFirst() throws Exception {
51-
5246
try (AutoCloseableResourcesFirst af = new AutoCloseableResourcesFirst(); AutoCloseableResourcesSecond as = new AutoCloseableResourcesSecond()) {
5347
af.doSomething();
5448
as.doSomething();
@@ -57,7 +51,6 @@ public void whenFirstAutoClosableResourceIsinitializedFirst_thenFirstAutoClosabl
5751
}
5852

5953
class AutoCloseableResourcesFirst implements AutoCloseable {
60-
6154
public AutoCloseableResourcesFirst() {
6255
System.out.println("Constructor -> AutoCloseableResources_First");
6356
}
@@ -70,12 +63,10 @@ public void doSomething() {
7063
public void close() throws Exception {
7164
System.out.println("Closed AutoCloseableResources_First");
7265
resource1Date = new Date();
73-
7466
}
7567
}
7668

7769
class AutoCloseableResourcesSecond implements AutoCloseable {
78-
7970
public AutoCloseableResourcesSecond() {
8071
System.out.println("Constructor -> AutoCloseableResources_Second");
8172
}
@@ -91,4 +82,5 @@ public void close() throws Exception {
9182
Thread.sleep(10000);
9283
}
9384
}
85+
9486
}

spring-data-cassandra/src/test/java/org/baeldung/spring/data/cassandra/repository/CQLQueriesIntegrationTest.java renamed to spring-data-cassandra/src/test/java/org/baeldung/spring/data/cassandra/repository/CqlQueriesIntegrationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838

3939
@RunWith(SpringJUnit4ClassRunner.class)
4040
@ContextConfiguration(classes = CassandraConfig.class)
41-
public class CQLQueriesIntegrationTest {
42-
private static final Log LOGGER = LogFactory.getLog(CQLQueriesIntegrationTest.class);
41+
public class CqlQueriesIntegrationTest {
42+
private static final Log LOGGER = LogFactory.getLog(CqlQueriesIntegrationTest.class);
4343

4444
public static final String KEYSPACE_CREATION_QUERY = "CREATE KEYSPACE IF NOT EXISTS testKeySpace " + "WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': '3' };";
4545

0 commit comments

Comments
 (0)