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

hazendaz / jmockit1 / 875

24 May 2026 05:41PM UTC coverage: 75.471% (-0.03%) from 75.496%
875

Pull #512

github

web-flow
Finalize modernizer updates and checked exception behavior

Agent-Logs-Url: https://github.com/hazendaz/jmockit1/sessions/ed08e1be-d91d-4d00-ab35-e5062b25acc0

Co-authored-by: hazendaz <975267+hazendaz@users.noreply.github.com>
Pull Request #512: Modernize flagged collection/reflection API usages in `main` module (Java 21 build path)

6026 of 8488 branches covered (70.99%)

Branch coverage included in aggregate %.

25 of 34 new or added lines in 15 files covered. (73.53%)

5 existing lines in 1 file now uncovered.

12659 of 16270 relevant lines covered (77.81%)

0.78 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.Comparator;
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

NEW
39
        fileNames.sort(Comparator.naturalOrder());
×
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