Package io.flowcov.camunda.model
Class ClassCoverage
- java.lang.Object
-
- io.flowcov.camunda.model.ClassCoverage
-
- All Implemented Interfaces:
AggregatedCoverage
public class ClassCoverage extends java.lang.Object implements AggregatedCoverage
Test class coverage model. The class coverage is an aggregation of all test method coverages.
-
-
Constructor Summary
Constructors Constructor Description ClassCoverage()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCoveredElement(java.lang.String testName, CoveredElement coveredElement)Adds a covered element to the test method coverage.voidaddTestMethodCoverage(java.lang.String testName, MethodCoverage testCoverage)Add a test method coverage to the class coverage.voidassertAllDeploymentsEqual()Asserts if all method deployments are equal.voidendCoveredElement(java.lang.String currentTestMethodName, CoveredElement coveredElement)Mark a covered element execution as ended.protected MethodCoveragegetAnyMethodCoverage()Retrieves the first method coverage found.doublegetCoveragePercentage()Retrieves the class coverage percentage.doublegetCoveragePercentage(java.lang.String processDefinitionKey)Retrieves the class coverage percentage for the given process definition key.java.util.Set<java.lang.String>getCoveredFlowNodeIds(java.lang.String processDefinitionKey)Retrieves a set of covered flow node IDs for the given process definition key.java.util.Set<CoveredFlowNode>getCoveredFlowNodes()Retrieves the covered flow nodes.java.util.Set<CoveredFlowNode>getCoveredFlowNodes(java.lang.String processDefinitionKey)Retrieves covered flow nodes for the given process definition key.java.util.Set<java.lang.String>getCoveredSequenceFlowIds(java.lang.String processDefinitionKey)Retrieves a set of covered sequence flow IDs for the given process definition key.java.util.Set<CoveredSequenceFlow>getCoveredSequenceFlows()Retrieves the covered sequence flows.java.util.Set<CoveredSequenceFlow>getCoveredSequenceFlows(java.lang.String processDefinitionKey)Retrieves a set of covered sequence flows for the given process definition key.java.util.Set<org.camunda.bpm.engine.repository.ProcessDefinition>getProcessDefinitions()Retrieves the process definitions of the coverage test.java.util.Map<java.lang.String,MethodCoverage>getTestMethodCoverage()Retrieves all method coverage.MethodCoveragegetTestMethodCoverage(java.lang.String testName)Retrieves a test methods coverage.
-
-
-
Method Detail
-
addCoveredElement
public void addCoveredElement(java.lang.String testName, CoveredElement coveredElement)Adds a covered element to the test method coverage.- Parameters:
testName-coveredElement-
-
endCoveredElement
public void endCoveredElement(java.lang.String currentTestMethodName, CoveredElement coveredElement)Mark a covered element execution as ended.- Parameters:
currentTestMethodName-coveredElement-
-
getTestMethodCoverage
public MethodCoverage getTestMethodCoverage(java.lang.String testName)
Retrieves a test methods coverage.- Parameters:
testName- The name of the test method.- Returns:
-
getTestMethodCoverage
public java.util.Map<java.lang.String,MethodCoverage> getTestMethodCoverage()
Retrieves all method coverage.- Returns:
-
addTestMethodCoverage
public void addTestMethodCoverage(java.lang.String testName, MethodCoverage testCoverage)Add a test method coverage to the class coverage.- Parameters:
testName-testCoverage-
-
getCoveragePercentage
public double getCoveragePercentage()
Retrieves the class coverage percentage. All covered test methods' elements are aggregated and checked against the process definition elements.- Specified by:
getCoveragePercentagein interfaceAggregatedCoverage- Returns:
- The coverage percentage.
-
getCoveragePercentage
public double getCoveragePercentage(java.lang.String processDefinitionKey)
Retrieves the class coverage percentage for the given process definition key. All covered test methods' elements are aggregated and checked against the process definition elements.- Specified by:
getCoveragePercentagein interfaceAggregatedCoverage- Parameters:
processDefinitionKey-- Returns:
- The coverage percentage.
-
getCoveredFlowNodes
public java.util.Set<CoveredFlowNode> getCoveredFlowNodes()
Retrieves the covered flow nodes. Flow nodes with the same element ID but different process definition keys are retained.- Returns:
- A set of covered flow nodes.
-
getCoveredFlowNodes
public java.util.Set<CoveredFlowNode> getCoveredFlowNodes(java.lang.String processDefinitionKey)
Description copied from interface:AggregatedCoverageRetrieves covered flow nodes for the given process definition key.- Specified by:
getCoveredFlowNodesin interfaceAggregatedCoverage- Returns:
-
getCoveredFlowNodeIds
public java.util.Set<java.lang.String> getCoveredFlowNodeIds(java.lang.String processDefinitionKey)
Retrieves a set of covered flow node IDs for the given process definition key.- Specified by:
getCoveredFlowNodeIdsin interfaceAggregatedCoverage- Returns:
-
getCoveredSequenceFlows
public java.util.Set<CoveredSequenceFlow> getCoveredSequenceFlows()
Retrieves the covered sequence flows. Sequence flows with the same element ID but different process definition keys are retained.- Returns:
- A set of covered flow nodes.
-
getCoveredSequenceFlowIds
public java.util.Set<java.lang.String> getCoveredSequenceFlowIds(java.lang.String processDefinitionKey)
Retrieves a set of covered sequence flow IDs for the given process definition key.- Specified by:
getCoveredSequenceFlowIdsin interfaceAggregatedCoverage- Returns:
-
getCoveredSequenceFlows
public java.util.Set<CoveredSequenceFlow> getCoveredSequenceFlows(java.lang.String processDefinitionKey)
Retrieves a set of covered sequence flows for the given process definition key.- Specified by:
getCoveredSequenceFlowsin interfaceAggregatedCoverage- Parameters:
processDefinitionKey-- Returns:
-
getProcessDefinitions
public java.util.Set<org.camunda.bpm.engine.repository.ProcessDefinition> getProcessDefinitions()
Retrieves the process definitions of the coverage test. Since there are multiple deployments (one for each test method) the first set of process definitions found is return.- Specified by:
getProcessDefinitionsin interfaceAggregatedCoverage- Returns:
-
getAnyMethodCoverage
protected MethodCoverage getAnyMethodCoverage()
Retrieves the first method coverage found.- Returns:
-
assertAllDeploymentsEqual
public void assertAllDeploymentsEqual()
Asserts if all method deployments are equal. (BPMNs with the same business keys)
-
-