StampTable.java

1
package pro.verron.officestamper.preset;
2
3
import org.springframework.lang.NonNull;
4
5
import java.util.*;
6
7
import static java.util.Collections.singletonList;
8
9
/**
10
 * Represents a table with several columns, a header line, and several lines of content
11
 *
12
 * @author Joseph Verron
13
 * @version ${version}
14
 * @since 1.6.2
15
 */
16
public class StampTable
17
        extends AbstractSequentialList<List<String>> {
18
    private final List<String> headers;
19
    private final List<List<String>> records;
20
21
    @Override public boolean equals(Object o) {
22 2 1. equals : negated conditional → NO_COVERAGE
2. equals : replaced boolean return with false for pro/verron/officestamper/preset/StampTable::equals → NO_COVERAGE
        if (this == o) return true;
23 3 1. equals : negated conditional → NO_COVERAGE
2. equals : replaced boolean return with true for pro/verron/officestamper/preset/StampTable::equals → NO_COVERAGE
3. equals : negated conditional → NO_COVERAGE
        if (o == null || getClass() != o.getClass()) return false;
24 2 1. equals : replaced boolean return with true for pro/verron/officestamper/preset/StampTable::equals → NO_COVERAGE
2. equals : negated conditional → NO_COVERAGE
        if (!super.equals(o)) return false;
25
        StampTable lists = (StampTable) o;
26 3 1. equals : negated conditional → NO_COVERAGE
2. equals : negated conditional → NO_COVERAGE
3. equals : replaced boolean return with true for pro/verron/officestamper/preset/StampTable::equals → NO_COVERAGE
        return Objects.equals(headers, lists.headers) && Objects.equals(records, lists.records);
27
    }
28
29
    @Override public int hashCode() {
30 1 1. hashCode : replaced int return with 0 for pro/verron/officestamper/preset/StampTable::hashCode → NO_COVERAGE
        return Objects.hash(super.hashCode(), headers, records);
31
    }
32
33
    /**
34
     * Instantiate an empty table
35
     */
36
    public StampTable() {
37
        this.headers = new ArrayList<>();
38
        this.records = new ArrayList<>();
39
    }
40
41
    /**
42
     * Instantiate a table with headers and several lines
43
     *
44
     * @param headers the header lines
45
     * @param records the lines that the table should contain
46
     */
47
    public StampTable(
48
            @NonNull List<String> headers,
49
            @NonNull List<List<String>> records
50
    ) {
51
        this.headers = headers;
52
        this.records = records;
53
    }
54
55
    @Override
56
    public int size() {
57 1 1. size : replaced int return with 0 for pro/verron/officestamper/preset/StampTable::size → KILLED
        return records.size();
58
    }
59
60
    @Override
61
    @NonNull
62
    public ListIterator<List<String>> listIterator(int index) {
63 1 1. listIterator : replaced return value with null for pro/verron/officestamper/preset/StampTable::listIterator → KILLED
        return records.listIterator(index);
64
    }
65
66
    /**
67
     * <p>empty.</p>
68
     *
69
     * @return a {@link StampTable} object
70
     */
71
    public static StampTable empty() {
72 1 1. empty : replaced return value with null for pro/verron/officestamper/preset/StampTable::empty → NO_COVERAGE
        return new StampTable(
73
                singletonList("placeholder"),
74
                singletonList(singletonList("placeholder"))
75
        );
76
    }
77
78
    /**
79
     * <p>headers.</p>
80
     *
81
     * @return a {@link List} object
82
     */
83
    public List<String> headers() {
84 1 1. headers : replaced return value with Collections.emptyList for pro/verron/officestamper/preset/StampTable::headers → KILLED
        return headers;
85
    }
86
87
}

Mutations

22

1.1
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : equals
Killed by : none
replaced boolean return with false for pro/verron/officestamper/preset/StampTable::equals → NO_COVERAGE

23

1.1
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : equals
Killed by : none
replaced boolean return with true for pro/verron/officestamper/preset/StampTable::equals → NO_COVERAGE

3.3
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

24

1.1
Location : equals
Killed by : none
replaced boolean return with true for pro/verron/officestamper/preset/StampTable::equals → NO_COVERAGE

2.2
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

26

1.1
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : equals
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : equals
Killed by : none
replaced boolean return with true for pro/verron/officestamper/preset/StampTable::equals → NO_COVERAGE

30

1.1
Location : hashCode
Killed by : none
replaced int return with 0 for pro/verron/officestamper/preset/StampTable::hashCode → NO_COVERAGE

57

1.1
Location : size
Killed by : pro.verron.officestamper.test.StampTableTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.StampTableTest]/[method:stampTableTest()]
replaced int return with 0 for pro/verron/officestamper/preset/StampTable::size → KILLED

63

1.1
Location : listIterator
Killed by : pro.verron.officestamper.test.StampTableTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.StampTableTest]/[method:stampTableTest()]
replaced return value with null for pro/verron/officestamper/preset/StampTable::listIterator → KILLED

72

1.1
Location : empty
Killed by : none
replaced return value with null for pro/verron/officestamper/preset/StampTable::empty → NO_COVERAGE

84

1.1
Location : headers
Killed by : pro.verron.officestamper.test.StampTableTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.StampTableTest]/[method:stampTableTest()]
replaced return value with Collections.emptyList for pro/verron/officestamper/preset/StampTable::headers → KILLED

Active mutators

Tests examined


Report generated by PIT 1.17.1