StandardPlaceholder.java

1
package pro.verron.officestamper.core;
2
3
import pro.verron.officestamper.api.Placeholder;
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
public record StandardPlaceholder(Matcher matcher, String expression)
10
        implements Placeholder {
11
12
    /// Retrieves the processed content of the placeholder. If the expression matches
13
    /// the criteria defined by the `Matcher`, the prefix and suffix are stripped from
14
    /// the expression. Otherwise, the original expression is returned.
15
    ///
16
    /// @return the inner content of the expression if the match criteria are met;
17
    /// otherwise, the complete original expression.
18
    @Override
19
    public String content() {
20 2 1. content : negated conditional → KILLED
2. content : replaced return value with "" for pro/verron/officestamper/core/StandardPlaceholder::content → KILLED
        return matcher.match(expression) ? matcher.strip(expression) : expression;
21
    }
22
23
    /// Returns a string representation of this object.
24
    /// The representation is enclosed in square brackets and includes the expression.
25
    ///
26
    /// @return a string in the format "\[expression]" where "expression" is the value of the expression field.
27
    @Override
28
    public String toString() {
29 1 1. toString : replaced return value with "" for pro/verron/officestamper/core/StandardPlaceholder::toString → SURVIVED
        return "[%s]".formatted(expression);
30
    }
31
}

Mutations

20

1.1
Location : content
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#12]
negated conditional → KILLED

2.2
Location : content
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testCustomResolution(java.lang.String, boolean, boolean, boolean, boolean, boolean, java.lang.String, boolean, java.lang.String)]/[test-template-invocation:#22]
replaced return value with "" for pro/verron/officestamper/core/StandardPlaceholder::content → KILLED

29

1.1
Location : toString
Killed by : none
replaced return value with "" for pro/verron/officestamper/core/StandardPlaceholder::toString → SURVIVED
Covering tests

Active mutators

Tests examined


Report generated by PIT 1.21.0