Skip to content

Commit 02cced1

Browse files
committed
Add support for coverage.
Still doesn't properly exclude lombok annotations
1 parent d5f4ace commit 02cced1

File tree

7 files changed

+120
-64
lines changed

7 files changed

+120
-64
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ build
66
.idea
77
specification.json
88
target
9+
.DS_Store

pom.xml

Lines changed: 113 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,6 @@
4848
<scope>test</scope>
4949
</dependency>
5050

51-
<dependency>
52-
<groupId>org.junit.jupiter</groupId>
53-
<artifactId>junit-jupiter-engine</artifactId>
54-
<version>5.4.0</version>
55-
<scope>test</scope>
56-
</dependency>
57-
5851
<dependency>
5952
<groupId>org.mockito</groupId>
6053
<artifactId>mockito-core</artifactId>
@@ -76,60 +69,120 @@
7669
<scope>test</scope>
7770
</dependency>
7871

79-
<!-- test -->
80-
<dependency>
81-
<groupId>org.junit.jupiter</groupId>
82-
<artifactId>junit-jupiter-engine</artifactId>
83-
<version>${junit.jupiter.version}</version>
84-
<scope>test</scope>
85-
</dependency>
86-
<dependency>
87-
<groupId>org.junit.jupiter</groupId>
88-
<artifactId>junit-jupiter-api</artifactId>
89-
<version>${junit.jupiter.version}</version>
90-
<scope>test</scope>
91-
</dependency>
92-
<dependency>
93-
<groupId>org.junit.jupiter</groupId>
94-
<artifactId>junit-jupiter-params</artifactId>
95-
<version>${junit.jupiter.version}</version>
96-
<scope>test</scope>
97-
</dependency>
98-
<dependency>
99-
<groupId>org.junit.platform</groupId>
100-
<artifactId>junit-platform-suite</artifactId>
101-
<version>1.8.1</version>
102-
<scope>test</scope>
103-
</dependency>
72+
<!-- test -->
73+
<dependency>
74+
<groupId>org.junit.jupiter</groupId>
75+
<artifactId>junit-jupiter-engine</artifactId>
76+
<version>${junit.jupiter.version}</version>
77+
<scope>test</scope>
78+
</dependency>
79+
<dependency>
80+
<groupId>org.junit.jupiter</groupId>
81+
<artifactId>junit-jupiter-api</artifactId>
82+
<version>${junit.jupiter.version}</version>
83+
<scope>test</scope>
84+
</dependency>
85+
<dependency>
86+
<groupId>org.junit.jupiter</groupId>
87+
<artifactId>junit-jupiter-params</artifactId>
88+
<version>${junit.jupiter.version}</version>
89+
<scope>test</scope>
90+
</dependency>
91+
<dependency>
92+
<groupId>org.junit.platform</groupId>
93+
<artifactId>junit-platform-suite</artifactId>
94+
<version>1.8.1</version>
95+
<scope>test</scope>
96+
</dependency>
10497
</dependencies>
10598

10699

107-
<build>
108-
<plugins>
109-
<plugin>
110-
<artifactId>maven-compiler-plugin</artifactId>
111-
<version>3.8.1</version>
112-
</plugin>
113-
<plugin>
114-
<groupId>org.apache.maven.plugins</groupId>
115-
<artifactId>maven-surefire-plugin</artifactId>
116-
<version>2.22.2</version>
117-
<configuration>
118-
<argLine>
119-
--illegal-access=permit
120-
</argLine>
121-
</configuration>
122-
</plugin>
123-
<plugin>
124-
<groupId>org.apache.maven.plugins</groupId>
125-
<artifactId>maven-failsafe-plugin</artifactId>
126-
<version>2.22.2</version>
127-
<configuration>
128-
<argLine>
129-
--illegal-access=permit
130-
</argLine>
131-
</configuration>
132-
</plugin>
133-
</plugins>
134-
</build>
100+
<build>
101+
<plugins>
102+
<plugin>
103+
<artifactId>maven-compiler-plugin</artifactId>
104+
<version>3.8.1</version>
105+
</plugin>
106+
<plugin>
107+
<groupId>org.apache.maven.plugins</groupId>
108+
<artifactId>maven-surefire-plugin</artifactId>
109+
<version>2.22.2</version>
110+
<configuration>
111+
<argLine>
112+
${surefireArgLine} --illegal-access=permit
113+
</argLine>
114+
</configuration>
115+
</plugin>
116+
<plugin>
117+
<groupId>org.apache.maven.plugins</groupId>
118+
<artifactId>maven-failsafe-plugin</artifactId>
119+
<version>2.22.2</version>
120+
<configuration>
121+
<argLine>
122+
--illegal-access=permit
123+
</argLine>
124+
</configuration>
125+
</plugin>
126+
127+
<plugin>
128+
<groupId>org.jacoco</groupId>
129+
<artifactId>jacoco-maven-plugin</artifactId>
130+
<version>0.8.8</version>
131+
132+
<executions>
133+
<execution>
134+
<id>prepare-agent</id>
135+
<goals>
136+
<goal>prepare-agent</goal>
137+
</goals>
138+
139+
<configuration>
140+
<destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
141+
<propertyName>surefireArgLine</propertyName>
142+
</configuration>
143+
</execution>
144+
145+
<execution>
146+
<id>report</id>
147+
<phase>test</phase>
148+
<goals>
149+
<goal>report</goal>
150+
</goals>
151+
152+
<configuration>
153+
<dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
154+
<outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
155+
</configuration>
156+
</execution>
157+
158+
159+
160+
<execution>
161+
<id>jacoco-check</id>
162+
<goals>
163+
<goal>check</goal>
164+
</goals>
165+
<configuration>
166+
<rules>
167+
<rule>
168+
<element>PACKAGE</element>
169+
<limits>
170+
<limit>
171+
<counter>LINE</counter>
172+
<value>COVEREDRATIO</value>
173+
<minimum>0.50</minimum>
174+
</limit>
175+
</limits>
176+
</rule>
177+
</rules>
178+
</configuration>
179+
</execution>
180+
181+
</executions>
182+
</plugin>
183+
</plugins>
184+
</build>
185+
186+
187+
135188
</project>

src/test/java/dev/openfeature/javasdk/EvalContextTests.java renamed to src/test/java/dev/openfeature/javasdk/EvalContextTest.java

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

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

9-
public class EvalContextTests {
9+
public class EvalContextTest {
1010
@Specification(number="3.1",
1111
text="The `evaluation context` structure **MUST** define an optional `targeting key` field of " +
1212
"type string, identifying the subject of the flag evaluation.")

src/test/java/dev/openfeature/javasdk/FlagEvaluationSpecTests.java renamed to src/test/java/dev/openfeature/javasdk/FlagEvaluationSpecTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import static org.junit.jupiter.api.Assertions.*;
1111
import static org.mockito.Mockito.*;
1212

13-
class FlagEvaluationSpecTests implements HookFixtures {
13+
class FlagEvaluationSpecTest implements HookFixtures {
1414

1515
private static final TestLogger TEST_LOGGER = TestLoggerFactory.getTestLogger(OpenFeatureClient.class);
1616

src/test/java/dev/openfeature/javasdk/HookSpecTests.java renamed to src/test/java/dev/openfeature/javasdk/HookSpecTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import static org.mockito.ArgumentMatchers.any;
1515
import static org.mockito.Mockito.*;
1616

17-
public class HookSpecTests implements HookFixtures {
17+
public class HookSpecTest implements HookFixtures {
1818
@AfterEach
1919
void emptyApiHooks() {
2020
// it's a singleton. Don't pollute each test.

src/test/java/dev/openfeature/javasdk/ProviderSpecTests.java renamed to src/test/java/dev/openfeature/javasdk/ProviderSpecTest.java

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

66
import static org.junit.jupiter.api.Assertions.*;
77

8-
public class ProviderSpecTests {
8+
public class ProviderSpecTest {
99
NoOpProvider p = new NoOpProvider();
1010

1111
@Specification(number="2.1", text="The provider interface MUST define a metadata member or accessor, containing a name field or accessor of type string, which identifies the provider implementation.")

src/test/java/lombok.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lombok.addLombokGeneratedAnnotation = true
2+

0 commit comments

Comments
 (0)