Skip to content

Commit cce9a34

Browse files
committed
optimize imports, update junit to 5.4, fix visibility of test methods and tes classes
1 parent 5c593b1 commit cce9a34

14 files changed

+45
-197
lines changed

pom.xml

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1515
<maven.compiler.source>1.8</maven.compiler.source>
1616
<maven.compiler.target>1.8</maven.compiler.target>
17-
<junit.platform.version>1.0.3</junit.platform.version>
18-
<junit.jupiter.version>5.0.3</junit.jupiter.version>
17+
<junit.jupiter.version>5.4.0</junit.jupiter.version>
1918
<travisBuildNumber>local</travisBuildNumber>
2019
</properties>
2120

@@ -58,13 +57,7 @@
5857
<!-- Test -->
5958
<dependency>
6059
<groupId>org.junit.jupiter</groupId>
61-
<artifactId>junit-jupiter-api</artifactId>
62-
<version>${junit.jupiter.version}</version>
63-
<scope>test</scope>
64-
</dependency>
65-
<dependency>
66-
<groupId>org.junit.jupiter</groupId>
67-
<artifactId>junit-jupiter-engine</artifactId>
60+
<artifactId>junit-jupiter</artifactId>
6861
<version>${junit.jupiter.version}</version>
6962
<scope>test</scope>
7063
</dependency>
@@ -94,24 +87,17 @@
9487
<plugin>
9588
<groupId>org.apache.maven.plugins</groupId>
9689
<artifactId>maven-surefire-plugin</artifactId>
97-
<version>2.19.1</version>
90+
<version>2.22.0</version>
9891
<configuration>
9992
<excludes>
10093
<exclude>**/*IT.java</exclude>
10194
</excludes>
10295
</configuration>
103-
<dependencies>
104-
<dependency>
105-
<groupId>org.junit.platform</groupId>
106-
<artifactId>junit-platform-surefire-provider</artifactId>
107-
<version>${junit.platform.version}</version>
108-
</dependency>
109-
</dependencies>
11096
</plugin>
11197
<plugin>
11298
<groupId>org.apache.maven.plugins</groupId>
11399
<artifactId>maven-failsafe-plugin</artifactId>
114-
<version>2.19.1</version>
100+
<version>2.22.0</version>
115101
<executions>
116102
<execution>
117103
<goals>
@@ -120,13 +106,6 @@
120106
</goals>
121107
</execution>
122108
</executions>
123-
<dependencies>
124-
<dependency>
125-
<groupId>org.junit.platform</groupId>
126-
<artifactId>junit-platform-surefire-provider</artifactId>
127-
<version>${junit.platform.version}</version>
128-
</dependency>
129-
</dependencies>
130109
</plugin>
131110
</plugins>
132111
<resources>

src/test/java/org/utplsql/cli/CliHelpTest.java

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

33
import org.junit.jupiter.api.Test;
44

5-
public class CliHelpTest {
5+
class CliHelpTest {
66

77
@Test
8-
public void showBasicHelp() {
8+
void showBasicHelp() {
99
TestHelper.runApp("help");
1010
}
1111
}

src/test/java/org/utplsql/cli/CliVersionInfoTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import static org.junit.jupiter.api.Assertions.assertTrue;
66

7-
public class CliVersionInfoTest {
7+
class CliVersionInfoTest {
88

99
@Test
1010
void getCliVersionInfo() {

src/test/java/org/utplsql/cli/ConnectionInfoTest.java

Lines changed: 0 additions & 130 deletions
This file was deleted.

src/test/java/org/utplsql/cli/FileWalkerTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
/**
1212
* Created by Vinicius on 18/06/2017.
1313
*/
14-
public class FileWalkerTest {
14+
class FileWalkerTest {
1515

1616
private final File BASE_DIR = new File(new File("").getAbsolutePath(), "assets/demo_project");
1717

1818
@Test
19-
public void fileWalker_Relative() {
19+
void fileWalker_Relative() {
2020
List<String> fileList = new FileWalker().getFileList(BASE_DIR, "source");
2121
Collections.sort(fileList);
2222
assertArrayEquals(new Object[] {
@@ -28,7 +28,7 @@ public void fileWalker_Relative() {
2828
}
2929

3030
@Test
31-
public void fileWalker_Absolute() {
31+
void fileWalker_Absolute() {
3232
List<String> fileList = new FileWalker().getFileList(BASE_DIR, "source", false);
3333
Collections.sort(fileList);
3434
assertArrayEquals(new Object[] {

src/test/java/org/utplsql/cli/HelpCommandTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@
1010
import static org.junit.jupiter.api.Assertions.assertEquals;
1111
import static org.junit.jupiter.api.Assertions.assertTrue;
1212

13-
public class HelpCommandTest {
13+
class HelpCommandTest {
1414

1515

1616
private SystemOutCapturer capturer;
1717

1818
@BeforeEach
19-
public void setupCaptureSystemOut() {
19+
void setupCaptureSystemOut() {
2020
capturer = new SystemOutCapturer();
2121
}
2222

2323
@Test
24-
public void callHelp() {
24+
void callHelp() {
2525

2626
capturer.start();
2727
int result = TestHelper.runApp("-h");
@@ -32,7 +32,7 @@ public void callHelp() {
3232
}
3333

3434
@Test
35-
public void callWithNoArgs() {
35+
void callWithNoArgs() {
3636

3737
capturer.start();
3838
int result = TestHelper.runApp();
@@ -43,7 +43,7 @@ public void callWithNoArgs() {
4343
}
4444

4545
@AfterEach
46-
public void cleanupCaptureSystemOut() throws IOException {
46+
void cleanupCaptureSystemOut() throws IOException {
4747
capturer.stop();
4848
}
4949
}

src/test/java/org/utplsql/cli/ReportersCommandIT.java

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

55
import static org.junit.jupiter.api.Assertions.assertEquals;
66

7-
public class ReportersCommandIT {
7+
class ReportersCommandIT {
88

99
@Test
10-
public void callReportersWorks() {
10+
void callReportersWorks() {
1111

1212
int result = TestHelper.runApp("reporters", TestHelper.getConnectionString());
1313

src/test/java/org/utplsql/cli/RunCommandConfigLevelTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import static org.junit.jupiter.api.Assertions.assertEquals;
99

10-
public class RunCommandConfigLevelTest {
10+
class RunCommandConfigLevelTest {
1111

1212
private Logger getRootLogger() {
1313
return (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);

src/test/java/org/utplsql/cli/RunCommandCoverageReporterIT.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@
99
import java.util.regex.Matcher;
1010
import java.util.regex.Pattern;
1111

12-
import static org.junit.jupiter.api.Assertions.assertEquals;
12+
import static org.junit.jupiter.api.Assertions.assertFalse;
1313
import static org.junit.jupiter.api.Assertions.assertTrue;
1414

1515
/**
1616
* System tests for Code Coverage Reporter
1717
*
1818
* @author pesse
1919
*/
20-
public class RunCommandCoverageReporterIT extends AbstractFileOutputTest {
20+
class RunCommandCoverageReporterIT extends AbstractFileOutputTest {
2121

2222
private static final Pattern REGEX_COVERAGE_TITLE = Pattern.compile("<a href=\"[a-zA-Z0-9#]+\" class=\"src_link\" title=\"[a-zA-Z\\._]+\">([a-zA-Z0-9\\._]+)<\\/a>");
2323

2424

2525
private String getTempCoverageFileName(int counter) {
2626

27-
return "tmpCoverage_" + String.valueOf(System.currentTimeMillis()) + "_" + String.valueOf(counter) + ".html";
27+
return "tmpCoverage_" + System.currentTimeMillis() + "_" + counter + ".html";
2828
}
2929

3030
/**
@@ -68,7 +68,7 @@ private boolean hasCoverageListed(String content, String packageName) {
6868
}
6969

7070
@Test
71-
public void run_CodeCoverageWithIncludeAndExclude() throws Exception {
71+
void run_CodeCoverageWithIncludeAndExclude() throws Exception {
7272

7373
Path coveragePath = getTempCoverageFilePath();
7474

@@ -78,14 +78,14 @@ public void run_CodeCoverageWithIncludeAndExclude() throws Exception {
7878

7979
String content = new String(Files.readAllBytes(coveragePath));
8080

81-
assertEquals(true, hasCoverageListed(content, "app.remove_rooms_by_name"));
82-
assertEquals(false, hasCoverageListed(content, "app.award_bonus"));
83-
assertEquals(false, hasCoverageListed(content, "app.betwnstr"));
81+
assertTrue(hasCoverageListed(content, "app.remove_rooms_by_name"));
82+
assertFalse(hasCoverageListed(content, "app.award_bonus"));
83+
assertFalse(hasCoverageListed(content, "app.betwnstr"));
8484

8585
}
8686

8787
@Test
88-
public void coverageReporterWriteAssetsToOutput() throws Exception {
88+
void coverageReporterWriteAssetsToOutput() throws Exception {
8989
Path coveragePath = getTempCoverageFilePath();
9090
Path coverageAssetsPath = Paths.get(coveragePath.toString() + "_assets");
9191

@@ -110,7 +110,7 @@ public void coverageReporterWriteAssetsToOutput() throws Exception {
110110
}
111111

112112
@Test
113-
public void coverageReporterWriteAssetsToSubfolder() throws Exception {
113+
void coverageReporterWriteAssetsToSubfolder() throws Exception {
114114

115115
Path origCoveratePath = getTempCoverageFilePath();
116116
Path coveragePath = Paths.get(origCoveratePath.toString(), origCoveratePath.toString());

src/test/java/org/utplsql/cli/RunCommandIT.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
/**
1212
* System tests for run command.
1313
*/
14-
public class RunCommandIT extends AbstractFileOutputTest {
14+
class RunCommandIT extends AbstractFileOutputTest {
1515

1616
@Test
17-
public void run_Default() throws Exception {
17+
void run_Default() throws Exception {
1818

1919
int result = TestHelper.runApp("run",
2020
TestHelper.getConnectionString(),
@@ -31,7 +31,7 @@ public void run_Default() throws Exception {
3131
}
3232

3333
@Test
34-
public void run_Debug() throws Exception {
34+
void run_Debug() throws Exception {
3535

3636
int result = TestHelper.runApp("run",
3737
TestHelper.getConnectionString(),
@@ -41,7 +41,7 @@ public void run_Debug() throws Exception {
4141
}
4242

4343
@Test
44-
public void run_MultipleReporters() throws Exception {
44+
void run_MultipleReporters() throws Exception {
4545

4646
String outputFileName = "output_" + System.currentTimeMillis() + ".xml";
4747
addTempPath(Paths.get(outputFileName));

0 commit comments

Comments
 (0)