1 /*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2013-2026 The Coveralls Maven Plugin Project Contributors:
5 * https://github.com/hazendaz/coveralls-maven-plugin/graphs/contributors
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 * THE SOFTWARE.
24 */
25 package org.eluder.coveralls.maven.plugin;
26
27 import java.util.List;
28
29 /**
30 * The Class CoverageFixture.
31 */
32 public final class CoverageFixture {
33
34 /** The java files. */
35 public static final List<List<String>> JAVA_FILES = List
36 .of(List.of("org/eluder/coverage/sample/SimpleCoverage.java", "14", "3,6", "10,11", "", ""),
37 List.of("org/eluder/coverage/sample/InnerClassCoverage.java", "31", "3,6,9,10,12,13,16,19,22",
38 "26,27", "", ""),
39 List.of("org/eluder/coverage/sample/PartialCoverage.java", "14", "3,6,7,11", "9", "6", "6"));
40
41 /** The java files it. */
42 public static final List<List<String>> JAVA_FILES_IT = List
43 .of(List.of("org/eluder/coverage/sample/SimpleCoverage.java", "14", "3,6", "10,11", "", ""),
44 List.of("org/eluder/coverage/sample/InnerClassCoverage.java", "31", "3,6,9,10,12,13,16,19,22",
45 "26,27", "", ""),
46 List.of("org/eluder/coverage/sample/PartialCoverage.java", "14", "3,6,7,9,11", "", "6", "6"));
47
48 /** The java files clover. */
49 public static final List<List<String>> JAVA_FILES_CLOVER = List
50 .of(List.of("org/eluder/coverage/sample/SimpleCoverage.java", "14", "5,6", "9,10", "", ""),
51 List.of("org/eluder/coverage/sample/InnerClassCoverage.java", "31", "5,6,7,9,12,15,16,21,22",
52 "25,26", "", ""),
53 List.of("org/eluder/coverage/sample/PartialCoverage.java", "14", "5,6,7,9", "", "6", "6"));
54
55 /** The javascript files. */
56 public static final List<List<String>> JAVASCRIPT_FILES = List.of(
57 List.of("Localization.js", "18", "1,2,4,5,9,13", "6,10", "", ""),
58 List.of("Components.js", "5", "1,2", "", "", ""));
59
60 /**
61 * Gets the total lines.
62 *
63 * @param fixture
64 * the fixture
65 *
66 * @return the total lines
67 */
68 public static int getTotalLines(List<List<String>> fixture) {
69 var lines = 0;
70 for (final List<String> file : fixture) {
71 lines += Integer.parseInt(file.get(1));
72 }
73 return lines;
74 }
75
76 /**
77 * Gets the total files.
78 *
79 * @param fixture
80 * the fixture
81 *
82 * @return the total files
83 */
84 public static int getTotalFiles(List<List<String>> fixture) {
85 return fixture.size();
86 }
87
88 /**
89 * Instantiates a new coverage fixture.
90 */
91 private CoverageFixture() {
92 // hide constructor
93 }
94
95 }