1 /*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2013 - 2023, Tapio Rautonen
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24 package org.eluder.coveralls.maven.plugin;
25
26 public final class CoverageFixture {
27
28 public static String[][] JAVA_FILES = new String[][] {
29 // file lines covered lines missed lines covered branches missed brnches
30 { "org/eluder/coverage/sample/SimpleCoverage.java", "14", "3,6", "10,11", "", "" },
31 { "org/eluder/coverage/sample/InnerClassCoverage.java", "31", "3,6,9,10,12,13,16,19,22", "26,27", "", "" },
32 { "org/eluder/coverage/sample/PartialCoverage.java", "14", "3,6,7,11", "9", "6", "6" }
33 };
34
35 public static String[][] JAVA_FILES_IT = new String[][] {
36 // file lines covered lines missed lines covered branches missed branches
37 { "org/eluder/coverage/sample/SimpleCoverage.java", "14", "3,6", "10,11", "", "" },
38 { "org/eluder/coverage/sample/InnerClassCoverage.java", "31", "3,6,9,10,12,13,16,19,22", "26,27", "", "" },
39 { "org/eluder/coverage/sample/PartialCoverage.java", "14", "3,6,7,9,11", "", "6", "6" }
40 };
41
42 public static String[][] JAVA_FILES_CLOVER = new String[][] {
43 // file lines covered lines missed lines
44 { "org/eluder/coverage/sample/SimpleCoverage.java", "14", "5,6", "9,10" },
45 { "org/eluder/coverage/sample/InnerClassCoverage.java", "31", "5,6,7,9,12,15,16,21,22", "25,26" },
46 { "org/eluder/coverage/sample/PartialCoverage.java", "14", "5,6,7,9", "" }
47 };
48
49 public static String[][] JAVASCRIPT_FILES = new String[][] {
50 // file lines covered lines missed lines covered branches missed branches
51 { "Localization.js", "18", "1,2,4,5,9,13", "6,10", "", "" },
52 { "Components.js", "5", "1,2", "", "", "" }
53 };
54
55 public static int getTotalLines(String[][] fixture) {
56 int lines = 0;
57 for (String[] file : fixture) {
58 lines += Integer.parseInt(file[1]);
59 }
60 return lines;
61 }
62
63 public static int getTotalFiles(String[][] fixture) {
64 return fixture.length;
65 }
66
67 private CoverageFixture() {
68 // hide constructor
69 }
70 }