Class MethodCoverage

  • All Implemented Interfaces:
    AggregatedCoverage

    public class MethodCoverage
    extends java.lang.Object
    implements AggregatedCoverage
    Coverage of an individual test method.

    A test method annotated with @Deployment does an independent deployment of the listed resources, hence this coverage is equivalent to a deployment coverage.

    • Constructor Summary

      Constructors 
      Constructor Description
      MethodCoverage​(java.lang.String deploymentId, java.lang.String name)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addCoveredElement​(CoveredElement element)
      Add a covered element to the method coverage.
      void addProcessCoverage​(ProcessCoverage processCoverage)
      Add a process coverage to the method coverage.
      void endCoveredElement​(CoveredElement element)
      Mark a covered element execution as ended.
      double getCoveragePercentage()
      Retrieves the coverage percentage for all process definitions deployed with the method.
      double getCoveragePercentage​(java.lang.String processDefinitionKey)
      Retrieves the coverage percentage for the given process definition key with the method.
      java.util.Set<java.lang.String> getCoveredFlowNodeIds​(java.lang.String processDefinitionKey)
      Retrieves a set of element IDs of covered flow nodes of the process definition identified by the passed key.
      java.util.Set<CoveredFlowNode> getCoveredFlowNodes()
      Retrieves a set of covered flow nodes of the process definitions deployed by this test method.
      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 element IDs of sequence flows of the process definition identified by the passed key.
      java.util.Set<CoveredSequenceFlow> getCoveredSequenceFlows()
      Retrieves a set of covered sequence flows of the process definitions deployed by this test method.
      java.util.Set<CoveredSequenceFlow> getCoveredSequenceFlows​(java.lang.String processDefinitionKey)
      Retrieves a set of elements of sequence flows of the process definition identified by the passed key.
      java.util.Set<org.camunda.bpm.engine.repository.ProcessDefinition> getProcessDefinitions()
      Retrieves the process definitions of the test method's deployment.
      java.util.Set<org.camunda.bpm.model.bpmn.instance.FlowNode> getProcessDefinitionsFlowNodes()
      Retrieves the flow nodes of all the process definitions in the method deployment.
      java.util.Set<org.camunda.bpm.model.bpmn.instance.FlowNode> getProcessDefinitionsFlowNodes​(java.lang.String processDefinitionKey)
      Retrieves the flow nodes for the process definition identified by the passed key in the method deployment.
      java.util.Set<org.camunda.bpm.model.bpmn.instance.SequenceFlow> getProcessDefinitionsSequenceFlows()
      Retrieves the sequence flows of all the process definitions in the method deployment.
      java.util.Set<org.camunda.bpm.model.bpmn.instance.SequenceFlow> getProcessDefinitionsSequenceFlows​(java.lang.String processDefinitionKey)
      Retrieves the sequence flows for the process definition identified by the passed key in the method deployment.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • MethodCoverage

        public MethodCoverage​(java.lang.String deploymentId,
                              java.lang.String name)
    • Method Detail

      • addProcessCoverage

        public void addProcessCoverage​(ProcessCoverage processCoverage)
        Add a process coverage to the method coverage.
        Parameters:
        processCoverage -
      • addCoveredElement

        public void addCoveredElement​(CoveredElement element)
        Add a covered element to the method coverage. The element is added according to the object fields.
        Parameters:
        element -
      • endCoveredElement

        public void endCoveredElement​(CoveredElement element)
        Mark a covered element execution as ended.
        Parameters:
        element -
      • getCoveragePercentage

        public double getCoveragePercentage()
        Retrieves the coverage percentage for all process definitions deployed with the method.
        Specified by:
        getCoveragePercentage in interface AggregatedCoverage
        Returns:
      • getCoveragePercentage

        public double getCoveragePercentage​(java.lang.String processDefinitionKey)
        Retrieves the coverage percentage for the given process definition key with the method.
        Specified by:
        getCoveragePercentage in interface AggregatedCoverage
        Parameters:
        processDefinitionKey -
        Returns:
      • getProcessDefinitionsFlowNodes

        public java.util.Set<org.camunda.bpm.model.bpmn.instance.FlowNode> getProcessDefinitionsFlowNodes()
        Retrieves the flow nodes of all the process definitions in the method deployment.
        Returns:
      • getProcessDefinitionsFlowNodes

        public java.util.Set<org.camunda.bpm.model.bpmn.instance.FlowNode> getProcessDefinitionsFlowNodes​(java.lang.String processDefinitionKey)
        Retrieves the flow nodes for the process definition identified by the passed key in the method deployment.
        Parameters:
        processDefinitionKey -
        Returns:
      • getProcessDefinitionsSequenceFlows

        public java.util.Set<org.camunda.bpm.model.bpmn.instance.SequenceFlow> getProcessDefinitionsSequenceFlows()
        Retrieves the sequence flows of all the process definitions in the method deployment.
        Returns:
      • getProcessDefinitionsSequenceFlows

        public java.util.Set<org.camunda.bpm.model.bpmn.instance.SequenceFlow> getProcessDefinitionsSequenceFlows​(java.lang.String processDefinitionKey)
        Retrieves the sequence flows for the process definition identified by the passed key in the method deployment.
        Parameters:
        processDefinitionKey -
        Returns:
      • getCoveredFlowNodes

        public java.util.Set<CoveredFlowNode> getCoveredFlowNodes()
        Retrieves a set of covered flow nodes of the process definitions deployed by this test method.
        Returns:
      • getCoveredSequenceFlows

        public java.util.Set<CoveredSequenceFlow> getCoveredSequenceFlows()
        Retrieves a set of covered sequence flows of the process definitions deployed by this test method.
        Returns:
      • getCoveredFlowNodeIds

        public java.util.Set<java.lang.String> getCoveredFlowNodeIds​(java.lang.String processDefinitionKey)
        Retrieves a set of element IDs of covered flow nodes of the process definition identified by the passed key.
        Specified by:
        getCoveredFlowNodeIds in interface AggregatedCoverage
        Returns:
      • getCoveredSequenceFlowIds

        public java.util.Set<java.lang.String> getCoveredSequenceFlowIds​(java.lang.String processDefinitionKey)
        Retrieves a set of element IDs of sequence flows of the process definition identified by the passed key.
        Specified by:
        getCoveredSequenceFlowIds in interface AggregatedCoverage
        Returns:
      • getCoveredSequenceFlows

        public java.util.Set<CoveredSequenceFlow> getCoveredSequenceFlows​(java.lang.String processDefinitionKey)
        Retrieves a set of elements of sequence flows of the process definition identified by the passed key.
        Specified by:
        getCoveredSequenceFlows in interface AggregatedCoverage
        Returns:
      • getProcessDefinitions

        public java.util.Set<org.camunda.bpm.engine.repository.ProcessDefinition> getProcessDefinitions()
        Retrieves the process definitions of the test method's deployment. The process definitions are compared by resource name and not the process key. As a result process definitions having the same process definition key but coming from separate BPMNs may be returned.
        Specified by:
        getProcessDefinitions in interface AggregatedCoverage
        Returns:
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object