• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hazendaz / jmockit1 / 496

15 Nov 2025 05:33PM UTC coverage: 72.192% (-0.008%) from 72.2%
496

push

github

web-flow
Merge pull request #412 from hazendaz/renovate/major-spring-core

Update spring core to v7 (major)

5677 of 8360 branches covered (67.91%)

Branch coverage included in aggregate %.

11922 of 16018 relevant lines covered (74.43%)

0.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/main/src/main/java/mockit/coverage/reporting/packages/ListWithFilesAndPercentages.java
1
/*
2
 * MIT License
3
 * Copyright (c) 2006-2025 JMockit developers
4
 * See LICENSE file for full license text.
5
 */
6
package mockit.coverage.reporting.packages;
7

8
import edu.umd.cs.findbugs.annotations.NonNull;
9
import edu.umd.cs.findbugs.annotations.Nullable;
10

11
import java.io.PrintWriter;
12
import java.util.Collections;
13
import java.util.List;
14

15
import mockit.coverage.CoveragePercentage;
16

17
import org.checkerframework.checker.index.qual.NonNegative;
18

19
abstract class ListWithFilesAndPercentages {
20
    @NonNull
21
    protected final PrintWriter output;
22
    @NonNull
23
    private final String baseIndent;
24
    @NonNegative
25
    int totalItems;
26
    @NonNegative
27
    int coveredItems;
28

29
    ListWithFilesAndPercentages(@NonNull PrintWriter output, @NonNull String baseIndent) {
×
30
        this.output = output;
×
31
        this.baseIndent = baseIndent;
×
32
    }
×
33

34
    final void writeMetricsForEachFile(@Nullable String packageName, @NonNull List<String> fileNames) {
35
        if (fileNames.isEmpty()) {
×
36
            return;
×
37
        }
38

39
        Collections.sort(fileNames);
×
40
        totalItems = 0;
×
41
        coveredItems = 0;
×
42

43
        for (String fileName : fileNames) {
×
44
            writeMetricsForFile(packageName, fileName);
×
45
        }
×
46
    }
×
47

48
    final void writeRowStart() {
49
        printIndent();
×
50
        output.println("<tr>");
×
51
    }
×
52

53
    final void writeRowClose() {
54
        printIndent();
×
55
        output.println("</tr>");
×
56
    }
×
57

58
    final void printIndent() {
59
        output.write(baseIndent);
×
60
    }
×
61

62
    protected abstract void writeMetricsForFile(@Nullable String packageName, @NonNull String fileName);
63

64
    final void printCoveragePercentage(@NonNegative int covered, @NonNegative int total, int percentage) {
65
        printIndent();
×
66
        output.write("  <td ");
×
67

68
        if (total > 0) {
×
69
            writeRowCellWithCoveragePercentage(covered, total, percentage);
×
70
        } else {
71
            output.write("class='nocode'>N/A");
×
72
        }
73

74
        output.println("</td>");
×
75
    }
×
76

77
    private void writeRowCellWithCoveragePercentage(@NonNegative int covered, @NonNegative int total,
78
            @NonNegative int percentage) {
79
        output.write("style='background-color:#");
×
80
        output.write(CoveragePercentage.percentageColor(covered, total));
×
81
        output.write("' title='Items: ");
×
82
        output.print(covered);
×
83
        output.write('/');
×
84
        output.print(total);
×
85
        output.write("'>");
×
86
        writePercentageValue(covered, total, percentage);
×
87
        output.print("%");
×
88
    }
×
89

90
    private void writePercentageValue(@NonNegative int covered, @NonNegative int total, @NonNegative int percentage) {
91
        if (percentage < 100) {
×
92
            output.print(percentage);
×
93
        } else if (covered == total) {
×
94
            output.print("100");
×
95
        } else {
96
            output.print(">99");
×
97
        }
98
    }
×
99
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc