Skip to content

Commit

Permalink
Adding jacoco verifications for complexity and coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
jottinger committed Aug 17, 2023
1 parent 26254ad commit 5e1b1c0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
27 changes: 27 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,32 @@ tasks.test {
}
tasks.jacocoTestReport {
dependsOn(tasks.test) // tests are required to run before generating the report
finalizedBy(tasks.jacocoTestCoverageVerification)
}

tasks.jacocoTestCoverageVerification {
violationRules {
rule {
limit {
counter = "INSTRUCTION"
minimum = "0.80".toBigDecimal()
}
limit {
counter = "BRANCH"
minimum = "0.80".toBigDecimal()
}
limit {
counter = "LINE"
minimum = "0.80".toBigDecimal()
}
limit {
counter = "CLASS"
minimum = "0.90".toBigDecimal()
}
limit {
counter = "COMPLEXITY"
maximum = "0.30".toBigDecimal()
}
}
}
}
7 changes: 7 additions & 0 deletions src/test/java/com/hendrix/test/SimpleDirectedGraphTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
import static org.junit.jupiter.api.Assertions.*;

public class SimpleDirectedGraphTest {
@Test
public void validateGraphHasVertex() {
var graph=new SimpleDirectedGraph();
var first=new Vertex<String>("first");
graph.addVertex(first);
assertTrue(graph.hasVertex(first));
}

@Test
public void validateVertexBelongsToGraph() {
Expand Down

0 comments on commit 5e1b1c0

Please sign in to comment.