AbstractCommentProcessor.java

1
package pro.verron.officestamper.api;
2
3
import org.docx4j.wml.P;
4
import org.docx4j.wml.R;
5
import org.springframework.lang.Nullable;
6
import pro.verron.officestamper.core.StandardParagraph;
7
8
import java.util.Objects;
9
10
/**
11
 * AbstractCommentProcessor is an abstract base class for comment processors.
12
 * It implements the CommentProcessor interface.
13
 * It provides common functionality and fields that subclasses can use.
14
 */
15
public abstract class AbstractCommentProcessor
16
        implements CommentProcessor {
17
18
    /**
19
     * PlaceholderReplacer used to replace expressions in the comment text.
20
     */
21
    protected final ParagraphPlaceholderReplacer placeholderReplacer;
22
    private Paragraph paragraph;
23
    private R currentRun;
24
    private Comment currentComment;
25
26
    /**
27
     * Creates an instance of AbstractCommentProcessor with the given ParagraphPlaceholderReplacer.
28
     *
29
     * @param placeholderReplacer the ParagraphPlaceholderReplacer used to replace expressions in the comment text
30
     */
31
    protected AbstractCommentProcessor(ParagraphPlaceholderReplacer placeholderReplacer) {
32
        this.placeholderReplacer = placeholderReplacer;
33
    }
34
35
    public Comment getCurrentCommentWrapper() {
36 1 1. getCurrentCommentWrapper : replaced return value with null for pro/verron/officestamper/api/AbstractCommentProcessor::getCurrentCommentWrapper → KILLED
        return currentComment;
37
    }
38
39
    @Override public void setCurrentCommentWrapper(Comment currentComment) {
40
        Objects.requireNonNull(currentComment.getCommentRangeStart());
41
        Objects.requireNonNull(currentComment.getCommentRangeEnd());
42
        this.currentComment = currentComment;
43
    }
44
45
    @Override public void setProcessorContext(ProcessorContext processorContext) {
46 1 1. setProcessorContext : removed call to pro/verron/officestamper/api/AbstractCommentProcessor::setParagraph → KILLED
        setParagraph(processorContext.paragraph());
47 1 1. setProcessorContext : removed call to pro/verron/officestamper/api/AbstractCommentProcessor::setCurrentRun → KILLED
        setCurrentRun(processorContext.run());
48 1 1. setProcessorContext : removed call to pro/verron/officestamper/api/AbstractCommentProcessor::setCurrentCommentWrapper → KILLED
        setCurrentCommentWrapper(processorContext.comment());
49
    }
50
51
    public R getCurrentRun() {
52 1 1. getCurrentRun : replaced return value with null for pro/verron/officestamper/api/AbstractCommentProcessor::getCurrentRun → KILLED
        return currentRun;
53
    }
54
55
    @Override public void setCurrentRun(@Nullable R run) {
56
        this.currentRun = run;
57
    }
58
59
    public Paragraph getParagraph() {
60 1 1. getParagraph : replaced return value with null for pro/verron/officestamper/api/AbstractCommentProcessor::getParagraph → KILLED
        return paragraph;
61
    }
62
63
    /**
64
     * @param paragraph coordinates of the currently processed paragraph within the template.
65
     *
66
     * @deprecated use {@link #setParagraph(Paragraph)} instead
67
     */
68
    @Deprecated(since = "2.6", forRemoval = true) public void setParagraph(P paragraph) {
69
        this.paragraph = StandardParagraph.from((DocxPart) paragraph.getParent(), paragraph);
70
    }
71
72
    public void setParagraph(Paragraph paragraph) {
73
        this.paragraph = paragraph;
74
    }
75
}

Mutations

36

1.1
Location : getCurrentCommentWrapper
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#14]
replaced return value with null for pro/verron/officestamper/api/AbstractCommentProcessor::getCurrentCommentWrapper → KILLED

46

1.1
Location : setProcessorContext
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#22]
removed call to pro/verron/officestamper/api/AbstractCommentProcessor::setParagraph → KILLED

47

1.1
Location : setProcessorContext
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#4]
removed call to pro/verron/officestamper/api/AbstractCommentProcessor::setCurrentRun → KILLED

48

1.1
Location : setProcessorContext
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#14]
removed call to pro/verron/officestamper/api/AbstractCommentProcessor::setCurrentCommentWrapper → KILLED

52

1.1
Location : getCurrentRun
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#4]
replaced return value with null for pro/verron/officestamper/api/AbstractCommentProcessor::getCurrentRun → KILLED

60

1.1
Location : getParagraph
Killed by : pro.verron.officestamper.test.DefaultTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.DefaultTests]/[test-template:features(java.lang.String, pro.verron.officestamper.api.OfficeStamperConfiguration, java.lang.Object, java.io.InputStream, java.lang.String)]/[test-template-invocation:#22]
replaced return value with null for pro/verron/officestamper/api/AbstractCommentProcessor::getParagraph → KILLED

Active mutators

Tests examined


Report generated by PIT 1.17.1