Skip to content

Commit 2dc8891

Browse files
committed
Cleaned tests
1 parent 7bc8279 commit 2dc8891

2 files changed

Lines changed: 64 additions & 99 deletions

File tree

‎src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java‎

Lines changed: 54 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -43,113 +43,78 @@ public static void setUp() throws VerificationException, IOException, XmlPullPar
4343
}
4444

4545
@Test
46-
public void testSimpleProject() {
47-
try {
48-
final String PROJECT_NAME = "simple-project";
49-
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
50-
51-
Verifier verifier = createVerifier(testProject);
52-
verifier.executeGoal("test");
53-
54-
checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml");
55-
} catch (Exception e) {
56-
e.printStackTrace();
57-
fail("Unexpected Exception running the test of Definition " + e.getMessage());
58-
}
46+
public void simpleProject() throws IOException, VerificationException {
47+
final String PROJECT_NAME = "simple-project";
48+
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
49+
50+
Verifier verifier = createVerifier(testProject);
51+
verifier.executeGoal("test");
52+
53+
checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml");
5954
}
6055

6156
@Test
62-
public void testRegexProject() {
63-
try {
64-
final String PROJECT_NAME = "regex-project";
65-
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
66-
67-
Verifier verifier = createVerifier(testProject);
68-
verifier.executeGoal("test");
69-
70-
checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml");
71-
} catch (Exception e) {
72-
e.printStackTrace();
73-
fail("Unexpected Exception running the test : " + e.getMessage());
74-
}
57+
public void regexProject() throws IOException, VerificationException {
58+
final String PROJECT_NAME = "regex-project";
59+
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
60+
61+
Verifier verifier = createVerifier(testProject);
62+
verifier.executeGoal("test");
63+
64+
checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml");
7565
}
7666

7767
@Test
78-
public void testTypeMappingProject() {
79-
try {
80-
final String PROJECT_NAME = "type-mapping-project";
81-
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
82-
83-
Verifier verifier = createVerifier(testProject);
84-
verifier.executeGoal("test");
85-
86-
checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml");
87-
} catch (Exception e) {
88-
e.printStackTrace();
89-
fail("Unexpected Exception running the test : " + e.getMessage());
90-
}
68+
public void typeMappingProject() throws IOException, VerificationException {
69+
final String PROJECT_NAME = "type-mapping-project";
70+
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
71+
72+
Verifier verifier = createVerifier(testProject);
73+
verifier.executeGoal("test");
74+
75+
checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml");
9176
}
9277

9378
@Test
94-
public void testOwnerParameterProject() {
95-
try {
96-
final String PROJECT_NAME = "owner-param-project";
97-
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
98-
99-
Verifier verifier = createVerifier(testProject);
100-
verifier.executeGoal("test");
101-
102-
checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml");
103-
} catch (Exception e) {
104-
e.printStackTrace();
105-
fail("Unexpected Exception running the test : " + e.getMessage());
106-
}
79+
public void ownerParameterProject() throws IOException, VerificationException {
80+
final String PROJECT_NAME = "owner-param-project";
81+
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
82+
83+
Verifier verifier = createVerifier(testProject);
84+
verifier.executeGoal("test");
85+
86+
checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml");
10787
}
10888

10989
@Test
110-
public void testMinimalistProject() {
111-
try {
112-
final String PROJECT_NAME = "minimalist-project";
113-
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
114-
115-
Verifier verifier = createVerifier(testProject);
116-
verifier.executeGoal("test");
117-
} catch (Exception e) {
118-
e.printStackTrace();
119-
fail("Unexpected Exception running the test : " + e.getMessage());
120-
}
90+
public void minimalistProject() throws IOException, VerificationException {
91+
final String PROJECT_NAME = "minimalist-project";
92+
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
93+
94+
Verifier verifier = createVerifier(testProject);
95+
verifier.executeGoal("test");
12196
}
12297

12398
@Test
124-
public void testTagsProject() {
125-
try {
126-
final String PROJECT_NAME = "tags-project";
127-
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
128-
129-
Verifier verifier = createVerifier(testProject);
130-
verifier.executeGoal("test");
131-
132-
checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml");
133-
} catch (Exception e) {
134-
e.printStackTrace();
135-
fail("Unexpected Exception running the test of Definition " + e.getMessage());
136-
}
99+
public void tagsProject() throws IOException, VerificationException {
100+
final String PROJECT_NAME = "tags-project";
101+
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
102+
103+
Verifier verifier = createVerifier(testProject);
104+
verifier.executeGoal("test");
105+
106+
checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml");
137107
}
138108

139109
@Test
140-
public void testSkipUtplsqlTests() {
141-
try {
142-
final String PROJECT_NAME = "skip-project";
143-
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
144-
145-
Verifier verifier = createVerifier(testProject);
146-
verifier.executeGoal("test");
147-
148-
assertFalse(new File("target/test-classes/" + PROJECT_NAME + "/target").exists());
149-
} catch (Exception e) {
150-
e.printStackTrace();
151-
fail("Unexpected Exception running the test of Definition " + e.getMessage());
152-
}
110+
public void skipUtplsqlTests() throws IOException, VerificationException {
111+
final String PROJECT_NAME = "skip-project";
112+
File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME);
113+
114+
Verifier verifier = createVerifier(testProject);
115+
verifier.executeGoal("test");
116+
117+
assertFalse(new File("target/test-classes/" + PROJECT_NAME + "/target").exists());
153118
}
154119

155120
/**

‎src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void setUp() throws Exception {
7272
* Then : it should throw a MojoExecutionException
7373
*/
7474
@Test
75-
public void testInvalidSourcesDirectory() throws Exception {
75+
public void invalidSourcesDirectory() throws Exception {
7676
UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule
7777
.lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalidTestsSourcesDirectories/"), "test");
7878
assertNotNull(utplsqlMojo);
@@ -90,7 +90,7 @@ public void testInvalidSourcesDirectory() throws Exception {
9090
* Then : it should throw a MojoExecutionException
9191
*/
9292
@Test
93-
public void testInvalidTestsDirectory() throws Exception {
93+
public void invalidTestsDirectory() throws Exception {
9494
UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule
9595
.lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalidTestsSourcesDirectories/"), "test");
9696
assertNotNull(utplsqlMojo);
@@ -108,7 +108,7 @@ public void testInvalidTestsDirectory() throws Exception {
108108
* Then : it should fill all parameters correctly
109109
*/
110110
@Test
111-
public void testSourcesTestsParameters() throws Exception {
111+
public void sourcesTestsParameters() throws Exception {
112112
UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule
113113
.lookupConfiguredMojo(new File("src/test/resources/unit-tests/testSourcesTestsParams/"), "test");
114114
assertNotNull(utplsqlMojo);
@@ -153,7 +153,7 @@ public void testSourcesTestsParameters() throws Exception {
153153
* Then : it should not find any source files
154154
*/
155155
@Test
156-
public void testSourcesAndTestsParameterDoesNotExist() throws Exception {
156+
public void sourcesAndTestsParameterDoesNotExist() throws Exception {
157157
UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule.lookupConfiguredMojo(
158158
new File("src/test/resources/unit-tests/testNoSourcesTestsParams/directoryDoesNotExist/"), "test");
159159
assertNotNull(utplsqlMojo);
@@ -175,7 +175,7 @@ public void testSourcesAndTestsParameterDoesNotExist() throws Exception {
175175
* Then : it should find all sources/tests files in default directories
176176
*/
177177
@Test
178-
public void testSourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() throws Exception {
178+
public void sourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() throws Exception {
179179
UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule
180180
.lookupConfiguredMojo(new File("src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/"), "test");
181181
assertNotNull(utplsqlMojo);
@@ -201,7 +201,7 @@ public void testSourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists()
201201
* Then : it should find all sources/tests files in default directories
202202
*/
203203
@Test
204-
public void testSourcesAndTestsParameterHaveNotDirectoryTag() throws Exception {
204+
public void sourcesAndTestsParameterHaveNotDirectoryTag() throws Exception {
205205
UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule
206206
.lookupConfiguredMojo(new File("src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/"), "test");
207207
assertNotNull(utplsqlMojo);
@@ -228,7 +228,7 @@ public void testSourcesAndTestsParameterHaveNotDirectoryTag() throws Exception {
228228
* Then : it should find all sources/tests files in default directories
229229
*/
230230
@Test
231-
public void testSourcesAndTestsParameterHaveNotIncludesTag() throws Exception {
231+
public void sourcesAndTestsParameterHaveNotIncludesTag() throws Exception {
232232
UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule
233233
.lookupConfiguredMojo(new File("src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/"), "test");
234234
assertNotNull(utplsqlMojo);
@@ -250,7 +250,7 @@ public void testSourcesAndTestsParameterHaveNotIncludesTag() throws Exception {
250250
* Default Console Behaviour
251251
*/
252252
@Test
253-
public void testDefaultConsoleBehaviour() throws Exception {
253+
public void defaultConsoleBehaviour() throws Exception {
254254
UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule
255255
.lookupConfiguredMojo(new File("src/test/resources/unit-tests/defaultConsoleOutputBehaviour/"), "test");
256256
assertNotNull(utplsqlMojo);
@@ -298,7 +298,7 @@ public void testDefaultConsoleBehaviour() throws Exception {
298298
* Add Default Reporter
299299
*/
300300
@Test
301-
public void testAddDefaultReporter() throws Exception {
301+
public void addDefaultReporter() throws Exception {
302302
UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule
303303
.lookupConfiguredMojo(new File("src/test/resources/unit-tests/defaultConsoleOutputBehaviour/"), "test");
304304
assertNotNull(utplsqlMojo);
@@ -325,7 +325,7 @@ public void testAddDefaultReporter() throws Exception {
325325
* Skip utPLSQL Tests
326326
*/
327327
@Test
328-
public void testSkipUtplsqlTests() throws Exception {
328+
public void skipUtplsqlTests() throws Exception {
329329
UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule
330330
.lookupConfiguredMojo(new File("src/test/resources/unit-tests/skipUtplsqlTests/"), "test");
331331
assertNotNull(utplsqlMojo);

0 commit comments

Comments
 (0)