• 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

8.57
/main/src/main/java/mockit/coverage/testRedundancy/TestCoverage.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.testRedundancy;
7

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

11
import java.lang.reflect.Method;
12
import java.util.ArrayList;
13
import java.util.LinkedHashMap;
14
import java.util.List;
15
import java.util.Map;
16
import java.util.Map.Entry;
17

18
import mockit.coverage.Configuration;
19

20
import org.checkerframework.checker.index.qual.NonNegative;
21

22
public final class TestCoverage {
23
    @Nullable
24
    public static final TestCoverage INSTANCE;
25

26
    static {
27
        INSTANCE = "true".equals(Configuration.getProperty("redundancy")) ? new TestCoverage() : null;
1!
28
    }
1✔
29

30
    @NonNull
×
31
    private final Map<Method, Integer> testsToItemsCovered = new LinkedHashMap<>();
32
    @Nullable
33
    private Method currentTestMethod;
34

35
    private TestCoverage() {
×
36
    }
×
37

38
    public void setCurrentTestMethod(@Nullable Method testMethod) {
39
        if (testMethod != null) {
×
40
            testsToItemsCovered.put(testMethod, 0);
×
41
        }
42

43
        currentTestMethod = testMethod;
×
44
    }
×
45

46
    public void recordNewItemCoveredByTestIfApplicable(@NonNegative int previousExecutionCount) {
47
        if (previousExecutionCount == 0 && currentTestMethod != null) {
×
48
            Integer itemsCoveredByTest = testsToItemsCovered.get(currentTestMethod);
×
49
            testsToItemsCovered.put(currentTestMethod, itemsCoveredByTest == null ? 1 : itemsCoveredByTest + 1);
×
50
        }
51
    }
×
52

53
    @NonNull
54
    public List<Method> getRedundantTests() {
55
        List<Method> redundantTests = new ArrayList<>();
×
56

57
        for (Entry<Method, Integer> testAndItemsCovered : testsToItemsCovered.entrySet()) {
×
58
            Method testMethod = testAndItemsCovered.getKey();
×
59
            Integer itemsCovered = testAndItemsCovered.getValue();
×
60

61
            if (itemsCovered == 0) {
×
62
                redundantTests.add(testMethod);
×
63
            }
64
        }
×
65

66
        return redundantTests;
×
67
    }
68
}
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