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

hazendaz / jmockit1 / 85

26 Apr 2025 06:37PM UTC coverage: 73.285% (-0.02%) from 73.308%
85

push

github

web-flow
Merge pull request #327 from hazendaz/paths

Use nio more per modernizer and update more tests to junit 5

5625 of 8178 branches covered (68.78%)

Branch coverage included in aggregate %.

5 of 43 new or added lines in 14 files covered. (11.63%)

3 existing lines in 3 files now uncovered.

11885 of 15715 relevant lines covered (75.63%)

0.76 hits per line

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

0.0
/main/src/main/java/mockit/coverage/DataFileMerging.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;
6

7
import edu.umd.cs.findbugs.annotations.NonNull;
8

9
import java.io.File;
10
import java.io.IOException;
11
import java.nio.file.Path;
12
import java.util.ArrayList;
13
import java.util.List;
14

15
import mockit.coverage.data.CoverageData;
16

17
final class DataFileMerging {
18
    @NonNull
19
    private final List<File> inputFiles;
20

21
    DataFileMerging(@NonNull String[] inputPaths) {
×
22
        inputFiles = new ArrayList<>(inputPaths.length);
×
23

24
        for (String path : inputPaths) {
×
25
            addInputFileToList(path.trim());
×
26
        }
27
    }
×
28

29
    private void addInputFileToList(@NonNull String path) {
30
        if (!path.isEmpty()) {
×
NEW
31
            File inputFile = Path.of(path).toFile();
×
32

33
            if (inputFile.isDirectory()) {
×
NEW
34
                inputFile = inputFile.toPath().resolve("coverage.ser").toFile();
×
35
            }
36

37
            inputFiles.add(inputFile);
×
38
        }
39
    }
×
40

41
    @NonNull
42
    CoverageData merge() throws IOException {
43
        CoverageData mergedData = null;
×
44

45
        for (File inputFile : inputFiles) {
×
46
            if (inputFile.exists()) {
×
47
                CoverageData existingData = CoverageData.readDataFromFile(inputFile);
×
48

49
                if (mergedData == null) {
×
50
                    mergedData = existingData;
×
51
                } else {
52
                    mergedData.merge(existingData);
×
53
                }
54
            }
55
        }
×
56

57
        if (mergedData == null) {
×
58
            throw new IllegalArgumentException("No input \"coverage.ser\" files found");
×
59
        }
60

61
        return mergedData;
×
62
    }
63
}
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