Package mockit.coverage.data
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 TypeMethodDescriptionvoid
clear()
void
getFileData
(@org.checkerframework.checker.index.qual.NonNegative int fileIndex) getFileData
(String file) getOrAddFile
(String file, String kindOfTopLevelType) int
getPercentage
(String fileNamePrefix) Computes the coverage percentage over a subset of the available source files.@org.checkerframework.checker.index.qual.NonNegative int
Finds the source file with the smallest coverage percentage.static CoverageData
instance()
boolean
isEmpty()
boolean
void
merge
(CoverageData previousData) static CoverageData
readDataFromFile
(File dataFile) Reads a serializedCoverageData
object from the given file (normally, a "coverage.ser
" file generated at the end of a previous test run).void
setWithCallPoints
(boolean withCallPoints) void
writeDataToFile
(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
@NonNull public FileCoverageData getFileData(@org.checkerframework.checker.index.qual.NonNegative int fileIndex) -
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, ornull
to consider all files- Returns:
- the computed percentage from
0
to100
(inclusive), or-1
if no meaningful value could be computed
-
getSmallestPerFilePercentage
public @org.checkerframework.checker.index.qual.NonNegative int getSmallestPerFilePercentage()Finds the source file with the smallest coverage percentage.- Returns:
- the percentage value for the file found, or
Integer.MAX_VALUE
if no file is found with a meaningful percentage
-
fillLastModifiedTimesForAllClassFiles
public void fillLastModifiedTimesForAllClassFiles() -
readDataFromFile
Reads a serializedCoverageData
object 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 serializedCoverageData
instance- Returns:
- a new object containing all coverage data resulting from a previous test run
- Throws:
IOException
-
writeDataToFile
- Throws:
IOException
-
merge
-