Class CoverageData

java.lang.Object
mockit.coverage.data.CoverageData
All Implemented Interfaces:
Serializable

public final class CoverageData extends Object implements Serializable
Coverage data captured for all source files exercised during a test run.
See Also:
  • Constructor Details

    • CoverageData

      public CoverageData()
  • Method Details

    • instance

      @NonNull public static CoverageData instance()
    • isWithCallPoints

      public boolean isWithCallPoints()
    • setWithCallPoints

      public void setWithCallPoints(boolean withCallPoints)
    • getFileToFileData

      @NonNull public Map<String,FileCoverageData> getFileToFileData()
    • getOrAddFile

      @NonNull public FileCoverageData getOrAddFile(@NonNull String file, @Nullable String kindOfTopLevelType)
    • getFileData

      @NonNull public FileCoverageData getFileData(@NonNull String file)
    • getFileData

      @NonNull public FileCoverageData getFileData(@org.checkerframework.checker.index.qual.NonNegative int fileIndex)
    • isEmpty

      public boolean isEmpty()
    • clear

      public void clear()
    • getPercentage

      public int getPercentage(@Nullable String fileNamePrefix)
      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, or null to consider all files
      Returns:
      the computed percentage from 0 to 100 (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

      @NonNull public static CoverageData readDataFromFile(@NonNull File dataFile) throws IOException
      Reads a serialized CoverageData 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 serialized CoverageData instance
      Returns:
      a new object containing all coverage data resulting from a previous test run
      Throws:
      IOException
    • writeDataToFile

      public void writeDataToFile(@NonNull File dataFile) throws IOException
      Throws:
      IOException
    • merge

      public void merge(@NonNull CoverageData previousData)