Class CoverageData
java.lang.Object
mockit.coverage.data.CoverageData
- All Implemented Interfaces:
Serializable
Coverage data captured for all source files exercised during a test run.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()voidgetFileData(@NonNegative int fileIndex) getFileData(String file) getOrAddFile(String file, String kindOfTopLevelType) intgetPercentage(String fileNamePrefix) Computes the coverage percentage over a subset of the available source files.@NonNegative intFinds the source file with the smallest coverage percentage.static CoverageDatainstance()booleanisEmpty()booleanvoidmerge(CoverageData previousData) static CoverageDatareadDataFromFile(File dataFile) Reads a serializedCoverageDataobject from the given file (normally, a "coverage.ser" file generated at the end of a previous test run).voidsetWithCallPoints(boolean withCallPoints) voidwriteDataToFile(File dataFile)
-
Constructor Details
-
CoverageData
public CoverageData()
-
-
Method Details
-
instance
-
isWithCallPoints
public boolean isWithCallPoints() -
setWithCallPoints
public void setWithCallPoints(boolean withCallPoints) -
getFileToFileData
-
getOrAddFile
@NonNull public FileCoverageData getOrAddFile(@NonNull String file, @Nullable String kindOfTopLevelType) -
getFileData
-
getFileData
-
isEmpty
public boolean isEmpty() -
clear
public void clear() -
getPercentage
Computes the coverage percentage over a subset of the available source files.- Parameters:
fileNamePrefix- a regular expression for matching the names of the source files to be considered, ornullto consider all files- Returns:
- the computed percentage from
0to100(inclusive), or-1if no meaningful value could be computed
-
getSmallestPerFilePercentage
public @NonNegative int getSmallestPerFilePercentage()Finds the source file with the smallest coverage percentage.- Returns:
- the percentage value for the file found, or
Integer.MAX_VALUEif no file is found with a meaningful percentage
-
fillLastModifiedTimesForAllClassFiles
public void fillLastModifiedTimesForAllClassFiles() -
readDataFromFile
Reads a serializedCoverageDataobject from the given file (normally, a "coverage.ser" file generated at the end of a previous test run).- Parameters:
dataFile- the ".ser" file containing a serializedCoverageDatainstance- Returns:
- a new object containing all coverage data resulting from a previous test run
- Throws:
IOException
-
writeDataToFile
- Throws:
IOException
-
merge
-