StandardPlaceholder.java

1
package pro.verron.officestamper.experimental;
2
3
import pro.verron.officestamper.core.Matcher;
4
5
/// The StandardPlaceholder class represents a placeholder with a specific
6
/// matching condition and associated expression.
7
/// It uses a [Matcher] to determine if the placeholder expression matches
8
/// a given prefix and suffix, and to extract the inner content of the placeholder.
9
///
10
/// @param matcher    the matcher to use for determining if the expression matches.
11
/// @param expression the expression string.
12
public record StandardPlaceholder(Matcher matcher, String expression)
13
        implements Placeholder {
14
15
    /// Retrieves the processed content of the placeholder. If the expression matches
16
    /// the criteria defined by the `Matcher`, the prefix and suffix are stripped from
17
    /// the expression. Otherwise, the original expression is returned.
18
    ///
19
    /// @return the inner content of the expression if the match criteria are met;
20
    /// otherwise, the complete original expression.
21
    @Override
22
    public String content() {
23 2 1. content : negated conditional → KILLED
2. content : replaced return value with "" for pro/verron/officestamper/experimental/StandardPlaceholder::content → KILLED
        return matcher.match(expression) ? matcher.strip(expression) : expression;
24
    }
25
26
    /// Returns a string representation of this object.
27
    /// The representation is enclosed in square brackets and includes the expression.
28
    ///
29
    /// @return a string in the format "\[expression]" where "expression" is the value of the expression field.
30
    @Override
31
    public String toString() {
32 1 1. toString : replaced return value with "" for pro/verron/officestamper/experimental/StandardPlaceholder::toString → NO_COVERAGE
        return "[%s]".formatted(expression);
33
    }
34
}

Mutations

23

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

2.2
Location : content
Killed by : pro.verron.officestamper.test.BasicPowerpointTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.BasicPowerpointTest]/[method:testStamper()]
replaced return value with "" for pro/verron/officestamper/experimental/StandardPlaceholder::content → KILLED

32

1.1
Location : toString
Killed by : none
replaced return value with "" for pro/verron/officestamper/experimental/StandardPlaceholder::toString → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.22.0