ToStringResolver.java

1
package pro.verron.officestamper.preset.resolvers.objects;
2
3
import org.docx4j.wml.R;
4
import org.springframework.lang.Nullable;
5
import pro.verron.officestamper.api.DocxPart;
6
import pro.verron.officestamper.api.ObjectResolver;
7
8
import static pro.verron.officestamper.utils.WmlFactory.newRun;
9
10
/**
11
 * This class is an implementation of the {@link ObjectResolver} interface
12
 * that resolves objects by converting them to a string representation using the
13
 * {@link Object#toString()} method and creating a new run with the resolved content.
14
 * <p>
15
 * * @author Joseph Verron
16
 * * @version ${version}
17
 * * @since 1.6.7
18
 */
19
public class ToStringResolver
20
        implements ObjectResolver {
21
    @Override
22
    public boolean canResolve(@Nullable Object object) {
23 2 1. canResolve : replaced boolean return with true for pro/verron/officestamper/preset/resolvers/objects/ToStringResolver::canResolve → SURVIVED
2. canResolve : negated conditional → KILLED
        return object != null;
24
    }
25
26
    @Override
27
    public R resolve(
28
            DocxPart document,
29
            String expression,
30
            Object object
31
    ) {
32 1 1. resolve : replaced return value with null for pro/verron/officestamper/preset/resolvers/objects/ToStringResolver::resolve → KILLED
        return newRun(String.valueOf(object));
33
    }
34
}

Mutations

23

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

2.2
Location : canResolve
Killed by : none
replaced boolean return with true for pro/verron/officestamper/preset/resolvers/objects/ToStringResolver::canResolve → SURVIVED
Covering tests

32

1.1
Location : resolve
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:#25]
replaced return value with null for pro/verron/officestamper/preset/resolvers/objects/ToStringResolver::resolve → KILLED

Active mutators

Tests examined


Report generated by PIT 1.17.1