Matcher.java

1
package pro.verron.officestamper.core;
2
3
4
/// The Matcher class provides methods to match and strip expressions based on a specified prefix and suffix.
5
/// The match() method checks if an expression starts with the prefix
6
/// and ends with the suffix.
7
/// The strip() method removes the prefix and suffix from an expression
8
/// and returns the inner part.
9
public record Matcher(String prefix, String suffix) {
10
11
    /// Checks if the given expression matches the specified criteria.
12
    ///
13
    /// @param expression the expression to be matched.
14
    ///
15
    /// @return `true` if the expression starts with the prefix
16
    /// and ends with the suffix,`false` otherwise.
17
    public boolean match(String expression) {
18 3 1. match : replaced boolean return with true for pro/verron/officestamper/core/Matcher::match → SURVIVED
2. match : negated conditional → KILLED
3. match : negated conditional → KILLED
        return expression.startsWith(prefix) && expression.endsWith(suffix);
19
    }
20
21
    /// Strips the prefix and suffix from the given expression and returns the inner part.
22
    ///
23
    /// @param expression the expression to be stripped.
24
    ///
25
    /// @return the inner part of the expression after stripping the prefix and suffix.
26
    public String strip(String expression) {
27
        int start = prefix.length();
28 1 1. strip : Replaced integer subtraction with addition → KILLED
        int end = expression.length() - suffix.length();
29 1 1. strip : replaced return value with "" for pro/verron/officestamper/core/Matcher::strip → KILLED
        return expression.substring(start, end);
30
    }
31
}

Mutations

18

1.1
Location : match
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:#28]
negated conditional → KILLED

2.2
Location : match
Killed by : none
replaced boolean return with true for pro/verron/officestamper/core/Matcher::match → SURVIVED
Covering tests

3.3
Location : match
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:#28]
negated conditional → KILLED

28

1.1
Location : strip
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:#29]
Replaced integer subtraction with addition → KILLED

29

1.1
Location : strip
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:#29]
replaced return value with "" for pro/verron/officestamper/core/Matcher::strip → KILLED

Active mutators

Tests examined


Report generated by PIT 1.20.0