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

hazendaz / jmockit1 / 421

30 Oct 2025 07:01PM UTC coverage: 72.198% (+0.02%) from 72.177%
421

push

github

hazendaz
Use better logic for remove redundant source directories

5681 of 8356 branches covered (67.99%)

Branch coverage included in aggregate %.

0 of 6 new or added lines in 1 file covered. (0.0%)

36 existing lines in 4 files now uncovered.

11941 of 16052 relevant lines covered (74.39%)

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/dataItems/InstanceFieldData.java
1
/*
2
 * Copyright (c) 2006 JMockit developers
3
 * This file is subject to the terms of the MIT license (see LICENSE.txt).
4
 */
5
package mockit.coverage.dataItems;
6

7
import static java.util.Collections.emptyList;
8

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

11
import java.util.Collection;
12
import java.util.HashMap;
13
import java.util.LinkedList;
14
import java.util.List;
15
import java.util.Map;
16

17
import mockit.internal.state.TestRun;
18

19
public final class InstanceFieldData extends FieldData {
×
20
    private static final long serialVersionUID = 6991762113575259754L;
21

22
    @NonNull
×
23
    private final transient Map<Integer, List<Integer>> testIdsToAssignments = new HashMap<>();
24

25
    void registerAssignment(@NonNull Object instance) {
26
        List<Integer> dataForRunningTest = getDataForRunningTest();
×
27
        Integer instanceId = System.identityHashCode(instance);
×
28

29
        if (!dataForRunningTest.contains(instanceId)) {
×
30
            dataForRunningTest.add(instanceId);
×
31
        }
32

33
        writeCount++;
×
34
    }
×
35

36
    void registerRead(@NonNull Object instance) {
37
        List<Integer> dataForRunningTest = getDataForRunningTest();
×
38
        Integer instanceId = System.identityHashCode(instance);
×
39

40
        dataForRunningTest.remove(instanceId);
×
41
        readCount++;
×
42
    }
×
43

44
    @NonNull
45
    private List<Integer> getDataForRunningTest() {
46
        int testId = TestRun.getTestId();
×
47
        return testIdsToAssignments.computeIfAbsent(testId, k -> new LinkedList<>());
×
48
    }
49

50
    @Override
51
    void markAsCoveredIfNoUnreadValuesAreLeft() {
UNCOV
52
        for (List<Integer> unreadInstances : testIdsToAssignments.values()) {
×
UNCOV
53
            if (unreadInstances.isEmpty()) {
×
54
                covered = true;
×
UNCOV
55
                break;
×
56
            }
UNCOV
57
        }
×
UNCOV
58
    }
×
59

60
    @NonNull
61
    public List<Integer> getOwnerInstancesWithUnreadAssignments() {
62
        if (isCovered()) {
×
UNCOV
63
            return emptyList();
×
64
        }
65

UNCOV
66
        Collection<List<Integer>> assignments = testIdsToAssignments.values();
×
UNCOV
67
        return assignments.iterator().next();
×
68
    }
69
}
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