Skip to content

Commit ccbd8d0

Browse files
committedDec 28, 2023
Add a test for NPE in #103
1 parent e90b566 commit ccbd8d0

File tree

13 files changed

+229
-0
lines changed

13 files changed

+229
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
invoker.goals=clean scoverage:report -e -ntp -pl module01 -pl module02/submodule02_02
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
5+
<parent>
6+
<groupId>it.scoverage-maven-plugin</groupId>
7+
<artifactId>test_report_for_some_submodules</artifactId>
8+
<version>1.0-SNAPSHOT</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
12+
<modelVersion>4.0.0</modelVersion>
13+
<artifactId>module01</artifactId>
14+
<name>Test Scoverage report works for specified submodules: Module 1</name>
15+
16+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package pkg01
2+
3+
class HelloService1
4+
{
5+
def hello =
6+
{
7+
"Hello from module 1"
8+
}
9+
10+
}
11+
12+
object HelloService1 extends HelloService1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package pkg01
2+
3+
import org.junit.Test;
4+
import org.junit.Assert.assertEquals
5+
6+
class HelloServiceTest
7+
{
8+
@Test
9+
def test1()
10+
{
11+
assertEquals("Hello from module 1", HelloService1.hello)
12+
}
13+
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
5+
<parent>
6+
<groupId>it.scoverage-maven-plugin</groupId>
7+
<artifactId>test_report_for_some_submodules</artifactId>
8+
<version>1.0-SNAPSHOT</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
12+
<modelVersion>4.0.0</modelVersion>
13+
<artifactId>module02</artifactId>
14+
<packaging>pom</packaging>
15+
<name>Test Scoverage report works for specified submodules: Module 2</name>
16+
17+
<modules>
18+
<module>submodule02_01</module>
19+
<module>submodule02_02</module>
20+
</modules>
21+
22+
23+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
5+
<parent>
6+
<groupId>it.scoverage-maven-plugin</groupId>
7+
<artifactId>module02</artifactId>
8+
<version>1.0-SNAPSHOT</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
12+
<modelVersion>4.0.0</modelVersion>
13+
<artifactId>submodule02_01</artifactId>
14+
<name>Test Scoverage report works for specified submodules: SubModule 2_1</name>
15+
16+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package pkg02_01
2+
3+
class HelloService2
4+
{
5+
def hello =
6+
{
7+
"Hello from submodule02_01"
8+
}
9+
10+
}
11+
12+
object HelloService2 extends HelloService2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package pkg02_01
2+
3+
import org.junit.Test;
4+
import org.junit.Assert.assertEquals
5+
6+
class HelloServiceTest
7+
{
8+
@Test
9+
def test2()
10+
{
11+
assertEquals("Hello from submodule02_01", HelloService2.hello)
12+
}
13+
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
5+
<parent>
6+
<groupId>it.scoverage-maven-plugin</groupId>
7+
<artifactId>module02</artifactId>
8+
<version>1.0-SNAPSHOT</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
12+
<modelVersion>4.0.0</modelVersion>
13+
<artifactId>submodule02_02</artifactId>
14+
<name>Test Scoverage report works for specified submodules: SubModule 2_2</name>
15+
16+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package pkg02_02
2+
3+
class HelloService2
4+
{
5+
def hello =
6+
{
7+
"Hello from submodule02_02"
8+
}
9+
10+
}
11+
12+
object HelloService2 extends HelloService2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package pkg02_02
2+
3+
import org.junit.Test;
4+
import org.junit.Assert.assertEquals
5+
6+
class HelloServiceTest
7+
{
8+
@Test
9+
def test2()
10+
{
11+
assertEquals("Hello from submodule02_02", HelloService2.hello)
12+
}
13+
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>it.scoverage-maven-plugin</groupId>
9+
<artifactId>integration_tests_parent</artifactId>
10+
<version>1.0-SNAPSHOT</version>
11+
<relativePath>../integration_tests_parent/pom.xml</relativePath>
12+
</parent>
13+
14+
<artifactId>test_report_for_some_submodules</artifactId>
15+
<version>1.0-SNAPSHOT</version>
16+
<packaging>pom</packaging>
17+
<name>Test Scoverage report works for specified submodules</name>
18+
<description>Test Scoverage report works for specified submodules</description>
19+
20+
<properties>
21+
<scala.compat.version>2.13</scala.compat.version>
22+
<scala.minor.version>12</scala.minor.version>
23+
</properties>
24+
25+
<modules>
26+
<module>module01</module>
27+
<module>module02</module>
28+
</modules>
29+
30+
<build>
31+
<plugins>
32+
<plugin>
33+
<groupId>org.apache.maven.plugins</groupId>
34+
<artifactId>maven-compiler-plugin</artifactId>
35+
</plugin>
36+
<plugin>
37+
<groupId>net.alchim31.maven</groupId>
38+
<artifactId>scala-maven-plugin</artifactId>
39+
</plugin>
40+
<plugin>
41+
<groupId>org.apache.maven.plugins</groupId>
42+
<artifactId>maven-surefire-plugin</artifactId>
43+
</plugin>
44+
<plugin>
45+
<groupId>@project.groupId@</groupId>
46+
<artifactId>@project.artifactId@</artifactId>
47+
<configuration>
48+
<aggregate>true</aggregate> <!-- for aggregated report -->
49+
</configuration>
50+
</plugin>
51+
</plugins>
52+
</build>
53+
54+
<reporting>
55+
<plugins>
56+
<plugin>
57+
<groupId>@project.groupId@</groupId>
58+
<artifactId>@project.artifactId@</artifactId>
59+
<configuration>
60+
<aggregate>true</aggregate> <!-- for aggregated report -->
61+
</configuration>
62+
</plugin>
63+
</plugins>
64+
</reporting>
65+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
try {
2+
3+
def aggregatedScoverageFile = new File(basedir, "target/scoverage.xml")
4+
assert aggregatedScoverageFile.exists()
5+
6+
def aggregatedReportFile = new File(basedir, "target/site/scoverage/index.html")
7+
assert aggregatedReportFile.exists()
8+
9+
return true
10+
11+
} catch (Throwable e) {
12+
e.printStackTrace()
13+
return false
14+
}

0 commit comments

Comments
 (0)