org.conqat.engine.sourcecode.coverage.SimpleStatementCoverageProbe Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of teamscale-commons Show documentation
Show all versions of teamscale-commons Show documentation
Provides common DTOs for Teamscale
The newest version!
package org.conqat.engine.sourcecode.coverage;
import org.conqat.lib.commons.assertion.CCSMAssert;
import org.conqat.lib.commons.test.IndexValueClass;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
/** Simple probe that carries a single execution count */
@IndexValueClass(containedInBackup = true)
public class SimpleStatementCoverageProbe extends CoverageProbeBase {
private static final long serialVersionUID = 1L;
@JsonProperty("executionCount")
private int executionCount;
@JsonCreator
public SimpleStatementCoverageProbe(@JsonProperty("line") int line,
@JsonProperty("executionCount") int executionCount) {
super(line);
this.executionCount = executionCount;
}
/** @see #executionCount */
public int getExecutionCount() {
return executionCount;
}
@Override
public String toString() {
return "line " + getLine() + " executed " + executionCount + " times";
}
@Override
@JsonIgnore
public int getCoverableCount() {
return 1;
}
@Override
@JsonIgnore
public int getCoveredCount() {
if (executionCount > 0) {
return 1;
}
return 0;
}
@Override
public boolean mergeWith(CoverageProbeBase otherProbe) {
CCSMAssert.isInstanceOf(otherProbe, SimpleStatementCoverageProbe.class);
executionCount += ((SimpleStatementCoverageProbe) otherProbe).executionCount;
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy