mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
coverage percentage: assume 0/0 to be 100% (IDEA-160268)
This commit is contained in:
@@ -232,7 +232,8 @@ public class JavaCoverageAnnotator extends BaseCoverageAnnotator {
|
||||
}
|
||||
|
||||
private static String getPercentage(int covered, int total) {
|
||||
return (int)((double)covered /total * 100) +"% (" + covered + "/" + total + ")";
|
||||
final int percentage = total == 0 ? 100 : (int)((double)covered / total * 100);
|
||||
return percentage + "% (" + covered + "/" + total + ")";
|
||||
}
|
||||
|
||||
public static PackageAnnotator.SummaryCoverageInfo merge(@Nullable final PackageAnnotator.SummaryCoverageInfo info,
|
||||
|
||||
@@ -470,7 +470,7 @@ public class PackageAnnotator {
|
||||
|
||||
classCoverageInfo.totalMethodCount += toplevelClassCoverageInfo.totalMethodCount;
|
||||
classCoverageInfo.coveredMethodCount += toplevelClassCoverageInfo.coveredMethodCount;
|
||||
if (toplevelClassCoverageInfo.coveredMethodCount > 0) {
|
||||
if (toplevelClassCoverageInfo.getCoveredLineCount() > 0) {
|
||||
classCoverageInfo.coveredClassCount++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user