Paragraph.java

1
package pro.verron.officestamper.api;
2
3
import org.docx4j.wml.R;
4
5
/**
6
 * The Paragraph interface represents a paragraph in a text document.
7
 * It provides methods for replacing a placeholder within the paragraph and retrieving the paragraph as a string.
8
 */
9
public interface Paragraph {
10
11
    /**
12
     * Replaces all occurrences of a placeholder with a specified replacement value within a paragraph.
13
     *
14
     * @param placeholder The placeholder to be replaced.
15
     * @param replacement The replacement value for the placeholder.
16
     *
17
     * @deprecated was used by the core to deal with multiline paragraphs, users should fallback to
18
     * {@link #replace(Placeholder, Object)} only
19
     */
20
    @Deprecated(since = "2.4", forRemoval = true)
21
    default void replaceAll(Placeholder placeholder, R replacement) {
22 1 1. replaceAll : negated conditional → NO_COVERAGE
        while (contains(placeholder.expression())) {
23 1 1. replaceAll : removed call to pro/verron/officestamper/api/Paragraph::replace → NO_COVERAGE
            replace(placeholder, replacement);
24
        }
25
    }
26
27
    /**
28
     * Returns true if the given expression is found within the paragraph, otherwise returns false.
29
     *
30
     * @param expression The string to search for within the paragraph.
31
     *
32
     * @return true if the given expression is found within the paragraph, otherwise false.
33
     *
34
     * @deprecated was used by the core to deal with multiline paragraphs
35
     */
36
    @Deprecated(since = "2.4", forRemoval = true)
37
    default boolean contains(String expression) {
38 2 1. contains : replaced boolean return with false for pro/verron/officestamper/api/Paragraph::contains → NO_COVERAGE
2. contains : replaced boolean return with true for pro/verron/officestamper/api/Paragraph::contains → NO_COVERAGE
        return asString().contains(expression);
39
    }
40
41
    /**
42
     * Replaces a placeholder in the given paragraph with the specified replacement.
43
     *
44
     * @param placeholder The placeholder to be replaced.
45
     * @param replacement The replacement for the placeholder.
46
     */
47
    void replace(Placeholder placeholder, Object replacement);
48
49
    /**
50
     * Returns the paragraph as a string.
51
     *
52
     * @return the paragraph as a string
53
     */
54
    String asString();
55
}

Mutations

22

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

23

1.1
Location : replaceAll
Killed by : none
removed call to pro/verron/officestamper/api/Paragraph::replace → NO_COVERAGE

38

1.1
Location : contains
Killed by : none
replaced boolean return with false for pro/verron/officestamper/api/Paragraph::contains → NO_COVERAGE

2.2
Location : contains
Killed by : none
replaced boolean return with true for pro/verron/officestamper/api/Paragraph::contains → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.17.0