DocxStamperConfiguration.java

1
package pro.verron.officestamper.core;
2
3
4
import org.springframework.expression.EvaluationContext;
5
import org.springframework.expression.spel.SpelParserConfiguration;
6
import org.springframework.lang.NonNull;
7
import pro.verron.officestamper.api.*;
8
import pro.verron.officestamper.api.CustomFunction.NeedsBiFunctionImpl;
9
import pro.verron.officestamper.api.CustomFunction.NeedsFunctionImpl;
10
import pro.verron.officestamper.core.functions.BiFunctionBuilder;
11
import pro.verron.officestamper.core.functions.FunctionBuilder;
12
import pro.verron.officestamper.core.functions.TriFunctionBuilder;
13
import pro.verron.officestamper.preset.CommentProcessorFactory;
14
import pro.verron.officestamper.preset.EvaluationContextConfigurers;
15
import pro.verron.officestamper.preset.ExceptionResolvers;
16
import pro.verron.officestamper.preset.Resolvers;
17
18
import java.util.ArrayList;
19
import java.util.HashMap;
20
import java.util.List;
21
import java.util.Map;
22
import java.util.function.Function;
23
import java.util.function.Supplier;
24
25
/**
26
 * The {@link DocxStamperConfiguration} class represents the configuration for
27
 * the {@link DocxStamper} class.
28
 * It provides methods to customize the behavior of the stamper.
29
 *
30
 * @author Joseph Verron
31
 * @author Tom Hombergs
32
 * @version ${version}
33
 * @since 1.0.3
34
 */
35
public class DocxStamperConfiguration
36
        implements OfficeStamperConfiguration {
37
    private final Map<Class<?>, Function<ParagraphPlaceholderReplacer, CommentProcessor>> commentProcessors =
38
            new HashMap<>();
39
    private final List<ObjectResolver> resolvers = new ArrayList<>();
40
    private final Map<Class<?>, Object> expressionFunctions = new HashMap<>();
41
    private final List<PreProcessor> preprocessors = new ArrayList<>();
42
    private final List<CustomFunction> functions = new ArrayList<>();
43
    private String lineBreakPlaceholder = "\n";
44
    private EvaluationContextConfigurer evaluationContextConfigurer = EvaluationContextConfigurers.defaultConfigurer();
45
    private boolean failOnUnresolvedExpression = true;
46
    private boolean leaveEmptyOnExpressionError = false;
47
    private boolean replaceUnresolvedExpressions = false;
48
    private String unresolvedExpressionsDefaultValue = null;
49
    private SpelParserConfiguration spelParserConfiguration = new SpelParserConfiguration();
50
    private ExceptionResolver exceptionResolver = computeExceptionResolver();
51
52
    /**
53
     * Creates a new configuration with default values.
54
     */
55
    public DocxStamperConfiguration() {
56
        CommentProcessorFactory pf = new CommentProcessorFactory(this);
57
        commentProcessors.put(CommentProcessorFactory.IRepeatProcessor.class, pf::repeat);
58
        commentProcessors.put(CommentProcessorFactory.IParagraphRepeatProcessor.class, pf::repeatParagraph);
59
        commentProcessors.put(CommentProcessorFactory.IRepeatDocPartProcessor.class, pf::repeatDocPart);
60
        commentProcessors.put(CommentProcessorFactory.ITableResolver.class, pf::tableResolver);
61
        commentProcessors.put(CommentProcessorFactory.IDisplayIfProcessor.class, pf::displayIf);
62
        commentProcessors.put(CommentProcessorFactory.IReplaceWithProcessor.class, pf::replaceWith);
63
64
        resolvers.addAll(List.of(Resolvers.image(),
65
                Resolvers.legacyDate(),
66
                Resolvers.isoDate(),
67
                Resolvers.isoTime(),
68
                Resolvers.isoDateTime(),
69
                Resolvers.nullToEmpty(),
70
                Resolvers.fallback()));
71
    }
72
73
    /**
74
     * Resets all the comment processors in the configuration. This method clears the
75
     * map of comment processors, effectively removing all registered comment processors.
76
     * Comment processors are used to process comments within the document.
77
     */
78
    public void resetCommentProcessors() {
79 1 1. resetCommentProcessors : removed call to java/util/Map::clear → SURVIVED
        this.commentProcessors.clear();
80
    }
81
82
    /**
83
     * Resets all the resolvers in the DocxStamperConfiguration object.
84
     * This method clears the list of resolvers, effectively removing all registered resolvers.
85
     * Resolvers are used to resolve objects during the stamping process.
86
     */
87
    public void resetResolvers() {
88 1 1. resetResolvers : removed call to java/util/List::clear → KILLED
        this.resolvers.clear();
89
    }
90
91
    /**
92
     * <p>isFailOnUnresolvedExpression.</p>
93
     *
94
     * @return a boolean
95
     */
96
    @Deprecated(since = "2.5", forRemoval = true) @Override public boolean isFailOnUnresolvedExpression() {
97 2 1. isFailOnUnresolvedExpression : replaced boolean return with true for pro/verron/officestamper/core/DocxStamperConfiguration::isFailOnUnresolvedExpression → NO_COVERAGE
2. isFailOnUnresolvedExpression : replaced boolean return with false for pro/verron/officestamper/core/DocxStamperConfiguration::isFailOnUnresolvedExpression → NO_COVERAGE
        return failOnUnresolvedExpression;
98
    }
99
100
    /**
101
     * If set to true, stamper will throw an {@link OfficeStamperException}
102
     * if a variable expression or processor expression within the document or within the comments is encountered that
103
     * cannot be resolved. Is set to true by default.
104
     *
105
     * @param failOnUnresolvedExpression a boolean
106
     *
107
     * @return a {@link DocxStamperConfiguration} object
108
     */
109
    @Deprecated(since = "2.5", forRemoval = true) @Override
110
    public DocxStamperConfiguration setFailOnUnresolvedExpression(boolean failOnUnresolvedExpression) {
111
        this.failOnUnresolvedExpression = failOnUnresolvedExpression;
112
        this.exceptionResolver = computeExceptionResolver();
113 1 1. setFailOnUnresolvedExpression : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::setFailOnUnresolvedExpression → NO_COVERAGE
        return this;
114
    }
115
116
    private ExceptionResolver computeExceptionResolver() {
117 2 1. computeExceptionResolver : negated conditional → KILLED
2. computeExceptionResolver : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::computeExceptionResolver → KILLED
        if (failOnUnresolvedExpression) return ExceptionResolvers.throwing();
118 2 1. computeExceptionResolver : negated conditional → NO_COVERAGE
2. computeExceptionResolver : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::computeExceptionResolver → NO_COVERAGE
        if (replaceWithDefaultOnError()) return ExceptionResolvers.defaulting(replacementDefault());
119 1 1. computeExceptionResolver : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::computeExceptionResolver → NO_COVERAGE
        return ExceptionResolvers.passing();
120
    }
121
122
    private boolean replaceWithDefaultOnError() {
123 3 1. replaceWithDefaultOnError : negated conditional → NO_COVERAGE
2. replaceWithDefaultOnError : replaced boolean return with true for pro/verron/officestamper/core/DocxStamperConfiguration::replaceWithDefaultOnError → NO_COVERAGE
3. replaceWithDefaultOnError : negated conditional → NO_COVERAGE
        return isLeaveEmptyOnExpressionError() || isReplaceUnresolvedExpressions();
124
    }
125
126
    private String replacementDefault() {
127 2 1. replacementDefault : replaced return value with "" for pro/verron/officestamper/core/DocxStamperConfiguration::replacementDefault → NO_COVERAGE
2. replacementDefault : negated conditional → NO_COVERAGE
        return isLeaveEmptyOnExpressionError() ? "" : getUnresolvedExpressionsDefaultValue();
128
    }
129
130
    /**
131
     * <p>isLeaveEmptyOnExpressionError.</p>
132
     *
133
     * @return a boolean
134
     */
135
    @Override public boolean isLeaveEmptyOnExpressionError() {
136 2 1. isLeaveEmptyOnExpressionError : replaced boolean return with false for pro/verron/officestamper/core/DocxStamperConfiguration::isLeaveEmptyOnExpressionError → NO_COVERAGE
2. isLeaveEmptyOnExpressionError : replaced boolean return with true for pro/verron/officestamper/core/DocxStamperConfiguration::isLeaveEmptyOnExpressionError → NO_COVERAGE
        return leaveEmptyOnExpressionError;
137
    }
138
139
    /**
140
     * <p>isReplaceUnresolvedExpressions.</p>
141
     *
142
     * @return a boolean
143
     */
144
    @Override public boolean isReplaceUnresolvedExpressions() {
145 2 1. isReplaceUnresolvedExpressions : replaced boolean return with true for pro/verron/officestamper/core/DocxStamperConfiguration::isReplaceUnresolvedExpressions → NO_COVERAGE
2. isReplaceUnresolvedExpressions : replaced boolean return with false for pro/verron/officestamper/core/DocxStamperConfiguration::isReplaceUnresolvedExpressions → NO_COVERAGE
        return replaceUnresolvedExpressions;
146
    }
147
148
    /**
149
     * <p>Getter for the field <code>unresolvedExpressionsDefaultValue</code>.</p>
150
     *
151
     * @return a {@link String} object
152
     */
153
    @Override public String getUnresolvedExpressionsDefaultValue() {
154 1 1. getUnresolvedExpressionsDefaultValue : replaced return value with "" for pro/verron/officestamper/core/DocxStamperConfiguration::getUnresolvedExpressionsDefaultValue → NO_COVERAGE
        return unresolvedExpressionsDefaultValue;
155
    }
156
157
    /**
158
     * Indicates the default value to use for expressions that doesn't resolve.
159
     *
160
     * @param unresolvedExpressionsDefaultValue value to use instead for expression that doesn't resolve
161
     *
162
     * @return a {@link DocxStamperConfiguration} object
163
     *
164
     * @see DocxStamperConfiguration#replaceUnresolvedExpressions
165
     */
166
    @Deprecated(since = "2.5", forRemoval = true) @Override
167
    public DocxStamperConfiguration unresolvedExpressionsDefaultValue(String unresolvedExpressionsDefaultValue) {
168
        this.unresolvedExpressionsDefaultValue = unresolvedExpressionsDefaultValue;
169
        this.exceptionResolver = computeExceptionResolver();
170 1 1. unresolvedExpressionsDefaultValue : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::unresolvedExpressionsDefaultValue → NO_COVERAGE
        return this;
171
    }
172
173
    /**
174
     * Indicates if a default value should replace expressions that don't resolve.
175
     *
176
     * @param replaceUnresolvedExpressions true to replace null value expression with resolved value (which is null),
177
     *                                     false to leave the expression as is
178
     *
179
     * @return a {@link DocxStamperConfiguration} object
180
     */
181
    @Deprecated(since = "2.5", forRemoval = true) @Override
182
    public DocxStamperConfiguration replaceUnresolvedExpressions(boolean replaceUnresolvedExpressions) {
183
        this.replaceUnresolvedExpressions = replaceUnresolvedExpressions;
184
        this.exceptionResolver = computeExceptionResolver();
185 1 1. replaceUnresolvedExpressions : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::replaceUnresolvedExpressions → NO_COVERAGE
        return this;
186
    }
187
188
    /**
189
     * If an error is caught while evaluating an expression, the expression will be replaced with an empty string
190
     * instead
191
     * of leaving the original expression in the document.
192
     *
193
     * @param leaveEmpty true to replace expressions with empty string when an error is caught while evaluating
194
     *
195
     * @return a {@link DocxStamperConfiguration} object
196
     */
197
    @Deprecated(since = "2.5", forRemoval = true) @Override public DocxStamperConfiguration leaveEmptyOnExpressionError(
198
            boolean leaveEmpty
199
    ) {
200
        this.leaveEmptyOnExpressionError = leaveEmpty;
201
        this.exceptionResolver = computeExceptionResolver();
202 1 1. leaveEmptyOnExpressionError : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::leaveEmptyOnExpressionError → NO_COVERAGE
        return this;
203
    }
204
205
    /**
206
     * Exposes all methods of a given interface to the expression language.
207
     *
208
     * @param interfaceClass the interface whose methods should be exposed in the expression language.
209
     * @param implementation the implementation that should be called to evaluate invocations of the interface methods
210
     *                       within the expression language. Must implement the interface above.
211
     *
212
     * @return a {@link DocxStamperConfiguration} object
213
     */
214
    @Override public DocxStamperConfiguration exposeInterfaceToExpressionLanguage(
215
            Class<?> interfaceClass, Object implementation
216
    ) {
217
        this.expressionFunctions.put(interfaceClass, implementation);
218 1 1. exposeInterfaceToExpressionLanguage : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::exposeInterfaceToExpressionLanguage → KILLED
        return this;
219
    }
220
221
    /**
222
     * Registers the specified ICommentProcessor as an implementation of the
223
     * specified interface.
224
     *
225
     * @param interfaceClass          the Interface which is implemented by the commentProcessor.
226
     * @param commentProcessorFactory the commentProcessor factory generating the specified interface.
227
     *
228
     * @return a {@link DocxStamperConfiguration} object
229
     */
230
    @Override public DocxStamperConfiguration addCommentProcessor(
231
            Class<?> interfaceClass, Function<ParagraphPlaceholderReplacer, CommentProcessor> commentProcessorFactory
232
    ) {
233
        this.commentProcessors.put(interfaceClass, commentProcessorFactory);
234 1 1. addCommentProcessor : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::addCommentProcessor → SURVIVED
        return this;
235
    }
236
237
    /**
238
     * Adds a preprocessor to the configuration.
239
     *
240
     * @param preprocessor the preprocessor to add.
241
     */
242
    @Override public void addPreprocessor(PreProcessor preprocessor) {
243
        preprocessors.add(preprocessor);
244
    }
245
246
    /**
247
     * <p>Getter for the field <code>lineBreakPlaceholder</code>.</p>
248
     *
249
     * @return a {@link String} object
250
     */
251
    @Override public String getLineBreakPlaceholder() {
252 1 1. getLineBreakPlaceholder : replaced return value with "" for pro/verron/officestamper/core/DocxStamperConfiguration::getLineBreakPlaceholder → KILLED
        return lineBreakPlaceholder;
253
    }
254
255
    /**
256
     * The String provided as lineBreakPlaceholder will be replaced with a line break
257
     * when stamping a document. If no lineBreakPlaceholder is provided, no replacement
258
     * will take place.
259
     *
260
     * @param lineBreakPlaceholder the String that should be replaced with line breaks during stamping.
261
     *
262
     * @return the configuration object for chaining.
263
     */
264
    @Override public DocxStamperConfiguration setLineBreakPlaceholder(@NonNull String lineBreakPlaceholder) {
265
        this.lineBreakPlaceholder = lineBreakPlaceholder;
266 1 1. setLineBreakPlaceholder : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::setLineBreakPlaceholder → KILLED
        return this;
267
    }
268
269
    /**
270
     * <p>Getter for the field <code>evaluationContextConfigurer</code>.</p>
271
     *
272
     * @return a {@link EvaluationContextConfigurer} object
273
     */
274
    @Override public EvaluationContextConfigurer getEvaluationContextConfigurer() {
275 1 1. getEvaluationContextConfigurer : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::getEvaluationContextConfigurer → KILLED
        return evaluationContextConfigurer;
276
    }
277
278
    /**
279
     * Provides an {@link EvaluationContextConfigurer} which may change the configuration of a Spring
280
     * {@link EvaluationContext} which is used for evaluating expressions
281
     * in comments and text.
282
     *
283
     * @param evaluationContextConfigurer the configurer to use.
284
     *
285
     * @return a {@link DocxStamperConfiguration} object
286
     */
287
    @Override public DocxStamperConfiguration setEvaluationContextConfigurer(
288
            EvaluationContextConfigurer evaluationContextConfigurer
289
    ) {
290
        this.evaluationContextConfigurer = evaluationContextConfigurer;
291 1 1. setEvaluationContextConfigurer : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::setEvaluationContextConfigurer → KILLED
        return this;
292
    }
293
294
    /**
295
     * <p>Getter for the field <code>spelParserConfiguration</code>.</p>
296
     *
297
     * @return a {@link SpelParserConfiguration} object
298
     */
299
    @Override public SpelParserConfiguration getSpelParserConfiguration() {
300 1 1. getSpelParserConfiguration : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::getSpelParserConfiguration → KILLED
        return spelParserConfiguration;
301
    }
302
303
    /**
304
     * Sets the {@link SpelParserConfiguration} to use for expression parsing.
305
     * <p>
306
     * Note that this configuration will be used for all expressions in the document, including expressions in comments!
307
     * </p>
308
     *
309
     * @param spelParserConfiguration the configuration to use.
310
     *
311
     * @return a {@link DocxStamperConfiguration} object
312
     */
313
    @Override public DocxStamperConfiguration setSpelParserConfiguration(
314
            SpelParserConfiguration spelParserConfiguration
315
    ) {
316
        this.spelParserConfiguration = spelParserConfiguration;
317 1 1. setSpelParserConfiguration : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::setSpelParserConfiguration → KILLED
        return this;
318
    }
319
320
    /**
321
     * <p>Getter for the field <code>expressionFunctions</code>.</p>
322
     *
323
     * @return a {@link Map} object
324
     */
325
    @Override public Map<Class<?>, Object> getExpressionFunctions() {
326 1 1. getExpressionFunctions : replaced return value with Collections.emptyMap for pro/verron/officestamper/core/DocxStamperConfiguration::getExpressionFunctions → KILLED
        return expressionFunctions;
327
    }
328
329
    /**
330
     * <p>Getter for the field <code>commentProcessors</code>.</p>
331
     *
332
     * @return a {@link Map} object
333
     */
334
    @Override public Map<Class<?>, Function<ParagraphPlaceholderReplacer, CommentProcessor>> getCommentProcessors() {
335 1 1. getCommentProcessors : replaced return value with Collections.emptyMap for pro/verron/officestamper/core/DocxStamperConfiguration::getCommentProcessors → KILLED
        return commentProcessors;
336
    }
337
338
    /**
339
     * <p>Getter for the field <code>preprocessors</code>.</p>
340
     *
341
     * @return a {@link List} object
342
     */
343
    @Override public List<PreProcessor> getPreprocessors() {
344 1 1. getPreprocessors : replaced return value with Collections.emptyList for pro/verron/officestamper/core/DocxStamperConfiguration::getPreprocessors → KILLED
        return preprocessors;
345
    }
346
347
    /**
348
     * Retrieves the list of resolvers.
349
     *
350
     * @return The list of object resolvers.
351
     */
352
    @Override public List<ObjectResolver> getResolvers() {
353 1 1. getResolvers : replaced return value with Collections.emptyList for pro/verron/officestamper/core/DocxStamperConfiguration::getResolvers → KILLED
        return resolvers;
354
    }
355
356
    /**
357
     * Sets the resolvers for resolving objects in the DocxStamperConfiguration.
358
     * <p>
359
     * This method is the evolution of the method {@code addTypeResolver},
360
     * and the order in which the resolvers are ordered is determinant - the first resolvers
361
     * in the list will be tried first. If a fallback resolver is desired, it should be placed last in the list.
362
     *
363
     * @param resolvers The list of ObjectResolvers to be set.
364
     *
365
     * @return The updated DocxStamperConfiguration instance.
366
     */
367
    @Override public DocxStamperConfiguration setResolvers(
368
            List<ObjectResolver> resolvers
369
    ) {
370 1 1. setResolvers : removed call to java/util/List::clear → NO_COVERAGE
        this.resolvers.clear();
371
        this.resolvers.addAll(resolvers);
372 1 1. setResolvers : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::setResolvers → NO_COVERAGE
        return this;
373
    }
374
375
    /**
376
     * Adds a resolver to the list of resolvers in the `DocxStamperConfiguration` object.
377
     * Resolvers are used to resolve objects during the stamping process.
378
     *
379
     * @param resolver The resolver to be added. This resolver should implement the `ObjectResolver` interface.
380
     *
381
     * @return The modified `DocxStamperConfiguration` object, with the resolver added to the beginning of the
382
     * resolver list.
383
     */
384
    @Override public DocxStamperConfiguration addResolver(ObjectResolver resolver) {
385 1 1. addResolver : removed call to java/util/List::addFirst → KILLED
        resolvers.addFirst(resolver);
386 1 1. addResolver : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::addResolver → KILLED
        return this;
387
    }
388
389
    @Override public ExceptionResolver getExceptionResolver() {
390 1 1. getExceptionResolver : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::getExceptionResolver → KILLED
        return exceptionResolver;
391
    }
392
393
    @Override public DocxStamperConfiguration setExceptionResolver(ExceptionResolver exceptionResolver) {
394
        this.exceptionResolver = exceptionResolver;
395 1 1. setExceptionResolver : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::setExceptionResolver → KILLED
        return this;
396
    }
397
398
    public void addCustomFunction(CustomFunction function) {
399
        this.functions.add(function);
400
    }
401
402
    @Override public List<CustomFunction> customFunctions() {
403 1 1. customFunctions : replaced return value with Collections.emptyList for pro/verron/officestamper/core/DocxStamperConfiguration::customFunctions → KILLED
        return functions;
404
    }
405
406
407
    @Override public void addCustomFunction(String name, Supplier<?> implementation) {
408 2 1. lambda$addCustomFunction$0 : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::lambda$addCustomFunction$0 → KILLED
2. addCustomFunction : removed call to pro/verron/officestamper/core/DocxStamperConfiguration::addCustomFunction → KILLED
        this.addCustomFunction(new CustomFunction(name, List.of(), args -> implementation.get()));
409
    }
410
411
412
    @Override public <T> NeedsFunctionImpl<T> addCustomFunction(String name, Class<T> class0) {
413 1 1. addCustomFunction : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::addCustomFunction → KILLED
        return new FunctionBuilder<>(this, name, class0);
414
    }
415
416
    @Override public <T, U> NeedsBiFunctionImpl<T, U> addCustomFunction(String name, Class<T> class0, Class<U> class1) {
417 1 1. addCustomFunction : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::addCustomFunction → KILLED
        return new BiFunctionBuilder<>(this, name, class0, class1);
418
    }
419
420
    @Override public <T, U, V> CustomFunction.NeedsTriFunctionImpl<T, U, V> addCustomFunction(
421
            String name,
422
            Class<T> class0, Class<U> class1, Class<V> class2
423
    ) {
424 1 1. addCustomFunction : replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::addCustomFunction → KILLED
        return new TriFunctionBuilder<>(this, name, class0, class1,class2);
425
    }
426
}

Mutations

79

1.1
Location : resetCommentProcessors
Killed by : none
removed call to java/util/Map::clear → SURVIVED
Covering tests

88

1.1
Location : resetResolvers
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:#21]
removed call to java/util/List::clear → KILLED

97

1.1
Location : isFailOnUnresolvedExpression
Killed by : none
replaced boolean return with true for pro/verron/officestamper/core/DocxStamperConfiguration::isFailOnUnresolvedExpression → NO_COVERAGE

2.2
Location : isFailOnUnresolvedExpression
Killed by : none
replaced boolean return with false for pro/verron/officestamper/core/DocxStamperConfiguration::isFailOnUnresolvedExpression → NO_COVERAGE

113

1.1
Location : setFailOnUnresolvedExpression
Killed by : none
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::setFailOnUnresolvedExpression → NO_COVERAGE

117

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

2.2
Location : computeExceptionResolver
Killed by : pro.verron.officestamper.test.SpelInjectionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.SpelInjectionTest]/[method:spelInjectionTest()]
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::computeExceptionResolver → KILLED

118

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

2.2
Location : computeExceptionResolver
Killed by : none
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::computeExceptionResolver → NO_COVERAGE

119

1.1
Location : computeExceptionResolver
Killed by : none
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::computeExceptionResolver → NO_COVERAGE

123

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

2.2
Location : replaceWithDefaultOnError
Killed by : none
replaced boolean return with true for pro/verron/officestamper/core/DocxStamperConfiguration::replaceWithDefaultOnError → NO_COVERAGE

3.3
Location : replaceWithDefaultOnError
Killed by : none
negated conditional → NO_COVERAGE

127

1.1
Location : replacementDefault
Killed by : none
replaced return value with "" for pro/verron/officestamper/core/DocxStamperConfiguration::replacementDefault → NO_COVERAGE

2.2
Location : replacementDefault
Killed by : none
negated conditional → NO_COVERAGE

136

1.1
Location : isLeaveEmptyOnExpressionError
Killed by : none
replaced boolean return with false for pro/verron/officestamper/core/DocxStamperConfiguration::isLeaveEmptyOnExpressionError → NO_COVERAGE

2.2
Location : isLeaveEmptyOnExpressionError
Killed by : none
replaced boolean return with true for pro/verron/officestamper/core/DocxStamperConfiguration::isLeaveEmptyOnExpressionError → NO_COVERAGE

145

1.1
Location : isReplaceUnresolvedExpressions
Killed by : none
replaced boolean return with true for pro/verron/officestamper/core/DocxStamperConfiguration::isReplaceUnresolvedExpressions → NO_COVERAGE

2.2
Location : isReplaceUnresolvedExpressions
Killed by : none
replaced boolean return with false for pro/verron/officestamper/core/DocxStamperConfiguration::isReplaceUnresolvedExpressions → NO_COVERAGE

154

1.1
Location : getUnresolvedExpressionsDefaultValue
Killed by : none
replaced return value with "" for pro/verron/officestamper/core/DocxStamperConfiguration::getUnresolvedExpressionsDefaultValue → NO_COVERAGE

170

1.1
Location : unresolvedExpressionsDefaultValue
Killed by : none
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::unresolvedExpressionsDefaultValue → NO_COVERAGE

185

1.1
Location : replaceUnresolvedExpressions
Killed by : none
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::replaceUnresolvedExpressions → NO_COVERAGE

202

1.1
Location : leaveEmptyOnExpressionError
Killed by : none
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::leaveEmptyOnExpressionError → NO_COVERAGE

218

1.1
Location : exposeInterfaceToExpressionLanguage
Killed by : pro.verron.officestamper.test.CustomFunctionTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.CustomFunctionTests]/[method:interfaces()]
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::exposeInterfaceToExpressionLanguage → KILLED

234

1.1
Location : addCommentProcessor
Killed by : none
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::addCommentProcessor → SURVIVED
Covering tests

252

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

266

1.1
Location : setLineBreakPlaceholder
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)]
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::setLineBreakPlaceholder → KILLED

275

1.1
Location : getEvaluationContextConfigurer
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:#30]
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::getEvaluationContextConfigurer → KILLED

291

1.1
Location : setEvaluationContextConfigurer
Killed by : pro.verron.officestamper.test.SpelInstantiationTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.SpelInstantiationTest]/[method:testDateInstantiationAndResolution()]
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::setEvaluationContextConfigurer → KILLED

300

1.1
Location : getSpelParserConfiguration
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:#30]
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::getSpelParserConfiguration → KILLED

317

1.1
Location : setSpelParserConfiguration
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)]
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::setSpelParserConfiguration → KILLED

326

1.1
Location : getExpressionFunctions
Killed by : pro.verron.officestamper.test.RegressionTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.RegressionTests]/[method:test64()]
replaced return value with Collections.emptyMap for pro/verron/officestamper/core/DocxStamperConfiguration::getExpressionFunctions → KILLED

335

1.1
Location : getCommentProcessors
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:#22]
replaced return value with Collections.emptyMap for pro/verron/officestamper/core/DocxStamperConfiguration::getCommentProcessors → KILLED

344

1.1
Location : getPreprocessors
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:#4]
replaced return value with Collections.emptyList for pro/verron/officestamper/core/DocxStamperConfiguration::getPreprocessors → KILLED

353

1.1
Location : getResolvers
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]
replaced return value with Collections.emptyList for pro/verron/officestamper/core/DocxStamperConfiguration::getResolvers → KILLED

370

1.1
Location : setResolvers
Killed by : none
removed call to java/util/List::clear → NO_COVERAGE

372

1.1
Location : setResolvers
Killed by : none
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::setResolvers → NO_COVERAGE

385

1.1
Location : addResolver
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:#32]
removed call to java/util/List::addFirst → KILLED

386

1.1
Location : addResolver
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)]
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::addResolver → KILLED

390

1.1
Location : getExceptionResolver
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:#30]
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::getExceptionResolver → KILLED

395

1.1
Location : setExceptionResolver
Killed by : pro.verron.officestamper.test.FailOnUnresolvedPlaceholderTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.FailOnUnresolvedPlaceholderTest]/[method:fails()]
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::setExceptionResolver → KILLED

403

1.1
Location : customFunctions
Killed by : pro.verron.officestamper.test.CustomFunctionTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.CustomFunctionTests]/[method:bifunctions()]
replaced return value with Collections.emptyList for pro/verron/officestamper/core/DocxStamperConfiguration::customFunctions → KILLED

408

1.1
Location : lambda$addCustomFunction$0
Killed by : pro.verron.officestamper.test.CustomFunctionTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.CustomFunctionTests]/[method:suppliers()]
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::lambda$addCustomFunction$0 → KILLED

2.2
Location : addCustomFunction
Killed by : pro.verron.officestamper.test.CustomFunctionTests.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.CustomFunctionTests]/[method:suppliers()]
removed call to pro/verron/officestamper/core/DocxStamperConfiguration::addCustomFunction → KILLED

413

1.1
Location : addCustomFunction
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testStaticResolution(java.lang.String, boolean, boolean, boolean, java.lang.String, java.lang.String)]/[test-template-invocation:#6]
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::addCustomFunction → KILLED

417

1.1
Location : addCustomFunction
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testStaticResolution(java.lang.String, boolean, boolean, boolean, java.lang.String, java.lang.String)]/[test-template-invocation:#6]
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::addCustomFunction → KILLED

424

1.1
Location : addCustomFunction
Killed by : pro.verron.officestamper.test.ResolutionTest.[engine:junit-jupiter]/[class:pro.verron.officestamper.test.ResolutionTest]/[test-template:testStaticResolution(java.lang.String, boolean, boolean, boolean, java.lang.String, java.lang.String)]/[test-template-invocation:#6]
replaced return value with null for pro/verron/officestamper/core/DocxStamperConfiguration::addCustomFunction → KILLED

Active mutators

Tests examined


Report generated by PIT 1.17.1