PowerpointCollector.java

1
package pro.verron.officestamper.experimental;
2
3
4
import java.util.ArrayList;
5
import java.util.List;
6
7
/// The PowerpointCollector class is used to collect instances of a specific class in a PowerPoint presentation.
8
///
9
/// @param <T> the type of instances to collect
10
public class PowerpointCollector<T>
11
        extends PowerpointVisitor {
12
    private final Class<T> aClass;
13
    private final List<T> list = new ArrayList<>();
14
15
    /// The PowerpointCollector class is used to collect instances of a specific class in a PowerPoint presentation.
16
    ///
17
    /// @param aClass the type of instances to collect
18
    public PowerpointCollector(Class<T> aClass) {
19
        this.aClass = aClass;
20
    }
21
22
    /// Collects instances of a specific class in a PowerPoint presentation.
23
    ///
24
    /// @param <T>      the type of instances to collect
25
    /// @param template the PowerPoint presentation template
26
    /// @param aClass   the type of instances to collect
27
    ///
28
    /// @return a list of instances of the specified class
29
    public static <T> List<T> collect(
30
            Object template,
31
            Class<T> aClass
32
    ) {
33
        var collector = new PowerpointCollector<>(aClass);
34 1 1. collect : removed call to pro/verron/officestamper/experimental/PowerpointCollector::visit → KILLED
        collector.visit(template);
35 1 1. collect : replaced return value with Collections.emptyList for pro/verron/officestamper/experimental/PowerpointCollector::collect → KILLED
        return collector.collect();
36
    }
37
38
    /// Retrieves the collected instances of a specific class.
39
    ///
40
    /// @return an instance list of the specified class
41
    public List<T> collect() {
42 1 1. collect : replaced return value with Collections.emptyList for pro/verron/officestamper/experimental/PowerpointCollector::collect → KILLED
        return list;
43
    }
44
45
    @Override
46
    protected void before(Object object) {
47 1 1. before : negated conditional → KILLED
        if (aClass.isInstance(object))
48
            list.add(aClass.cast(object));
49
    }
50
}

Mutations

34

1.1
Location : collect
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
removed call to pro/verron/officestamper/experimental/PowerpointCollector::visit → KILLED

35

1.1
Location : collect
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
replaced return value with Collections.emptyList for pro/verron/officestamper/experimental/PowerpointCollector::collect → KILLED

42

1.1
Location : collect
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
replaced return value with Collections.emptyList for pro/verron/officestamper/experimental/PowerpointCollector::collect → KILLED

47

1.1
Location : before
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
negated conditional → KILLED

Active mutators

Tests examined


Report generated by PIT 1.21.0