Skip to content

Commit 694afd2

Browse files
committed
Added StringUtilTest and includeObject test
1 parent d4a29fa commit 694afd2

File tree

3 files changed

+104
-3
lines changed

3 files changed

+104
-3
lines changed

src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,11 @@ public void db_config_using_system_properties() throws Exception {
306306
}
307307

308308
/**
309-
* DB configuration from System Properties
309+
* Exclude object from coverage report
310310
* <p>
311-
* Given : a pom.xml without dbUrl, dbUser and dbPass configured
311+
* Given : a pom.xml with excludeObject set
312312
* When : pom is read
313-
* Then : System Properties must be used to configure database
313+
* Then : excludeObject is present
314314
*/
315315
@Test
316316
public void exclude_object() throws Exception {
@@ -322,6 +322,23 @@ public void exclude_object() throws Exception {
322322
assertEquals("app.pkg_test_me,app.test_pkg_test_me", utPlsqlMojo.excludeObject);
323323
}
324324

325+
/**
326+
* Include object from coverage report
327+
* <p>
328+
* Given : a pom.xml with includeObject set
329+
* When : pom is read
330+
* Then : includeObject is present
331+
*/
332+
@Test
333+
public void include_object() throws Exception {
334+
UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("include_object");
335+
assertNotNull(utPlsqlMojo);
336+
337+
utPlsqlMojo.execute();
338+
339+
assertEquals("app.pkg_test_me,app.test_pkg_test_me", utPlsqlMojo.includeObject);
340+
}
341+
325342
private UtPlsqlMojo createUtPlsqlMojo(String directory) throws Exception {
326343
return (UtPlsqlMojo) rule.lookupConfiguredMojo(new File("src/test/resources/unit-tests/" + directory), "test");
327344
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package org.utplsql.maven.plugin.util;
2+
3+
import org.junit.jupiter.api.Test;
4+
5+
import static org.junit.jupiter.api.Assertions.assertTrue;
6+
import static org.utplsql.maven.plugin.util.StringUtil.isBlank;
7+
import static org.utplsql.maven.plugin.util.StringUtil.isEmpty;
8+
import static org.utplsql.maven.plugin.util.StringUtil.isNotBlank;
9+
import static org.utplsql.maven.plugin.util.StringUtil.isNotEmpty;
10+
11+
class StringUtilTest {
12+
13+
@Test
14+
void is_empty() {
15+
assertTrue(isEmpty(""));
16+
}
17+
18+
@Test
19+
void is_not_empty() {
20+
assertTrue(isNotEmpty("abc"));
21+
}
22+
23+
@Test
24+
void is_blank() {
25+
assertTrue(isBlank(" "));
26+
}
27+
28+
@Test
29+
void is_not_blank() {
30+
assertTrue(isNotBlank("abc"));
31+
}
32+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>org.utplsql</groupId>
7+
<artifactId>utplsql-maven-plugin-test</artifactId>
8+
<version>3.1.0-SNAPSHOT</version>
9+
<packaging>pom</packaging>
10+
11+
<properties>
12+
<dbUrl>jdbc:oracle:thin:@127.0.0.1:1521:xe</dbUrl>
13+
<dbUser>UT3</dbUser>
14+
<dbPass>UT3</dbPass>
15+
</properties>
16+
17+
<build>
18+
<directory>../../../target</directory>
19+
<plugins>
20+
<plugin>
21+
<groupId>org.utplsql</groupId>
22+
<artifactId>utplsql-maven-plugin</artifactId>
23+
<version>@proj</version>
24+
<goals>
25+
<goal>test</goal>
26+
</goals>
27+
<configuration>
28+
<ignoreFailure>false</ignoreFailure>
29+
<paths>
30+
<path>app</path>
31+
</paths>
32+
<reporters>
33+
<reporter>
34+
<name>UT_DOCUMENTATION_REPORTER</name>
35+
</reporter>
36+
<reporter>
37+
<name>UT_COVERAGE_SONAR_REPORTER</name>
38+
<fileOutput>coverage-sonar-report.xml</fileOutput>
39+
<consoleOutput>false</consoleOutput>
40+
</reporter>
41+
<reporter>
42+
<name>UT_SONAR_TEST_REPORTER</name>
43+
<fileOutput>utplsql/sonar-test-report.xml</fileOutput>
44+
<consoleOutput>true</consoleOutput>
45+
</reporter>
46+
</reporters>
47+
<includeObject>app.pkg_test_me,app.test_pkg_test_me</includeObject>
48+
</configuration>
49+
</plugin>
50+
</plugins>
51+
</build>
52+
</project>

0 commit comments

Comments
 (0)