ThymeleafV2TemplateOptionsApplier.java

1
package fr.sii.ogham.template.thymeleaf.v2.adapter;
2
3
import java.util.function.Consumer;
4
5
import org.thymeleaf.templateresolver.ITemplateResolver;
6
import org.thymeleaf.templateresolver.TemplateResolver;
7
8
import fr.sii.ogham.template.thymeleaf.common.TemplateResolverOptions;
9
import fr.sii.ogham.template.thymeleaf.common.adapter.TemplateResolverOptionsApplier;
10
11
/**
12
 * Apply options on {@link TemplateResolver} instance (configurable).
13
 * 
14
 * @author Aurélien Baudet
15
 *
16
 */
17
public class ThymeleafV2TemplateOptionsApplier implements TemplateResolverOptionsApplier {
18
19
	@Override
20
	public void apply(ITemplateResolver templateResolver, TemplateResolverOptions options) {
21 1 1. apply : negated conditional → RUN_ERROR
		if (templateResolver instanceof TemplateResolver) {
22
			// TODO: handle other options ?
23
			TemplateResolver resolver = (TemplateResolver) templateResolver;
24 1 1. apply : removed call to fr/sii/ogham/template/thymeleaf/v2/adapter/ThymeleafV2TemplateOptionsApplier::set → RUN_ERROR
			set(resolver::setTemplateMode, options.getTemplateMode());
25 1 1. apply : removed call to fr/sii/ogham/template/thymeleaf/v2/adapter/ThymeleafV2TemplateOptionsApplier::set → RUN_ERROR
			set(resolver::setCacheable, options.getCacheable());
26
		}
27
	}
28
29
	private <T> void set(Consumer<T> setter, T value) {
30 1 1. set : negated conditional → RUN_ERROR
		if (value != null) {
31 1 1. set : removed call to java/util/function/Consumer::accept → RUN_ERROR
			setter.accept(value);
32
		}
33
	}
34
35
}

Mutations

21

1.1
Location : apply
Killed by :
negated conditional → RUN_ERROR

24

1.1
Location : apply
Killed by :
removed call to fr/sii/ogham/template/thymeleaf/v2/adapter/ThymeleafV2TemplateOptionsApplier::set → RUN_ERROR

25

1.1
Location : apply
Killed by :
removed call to fr/sii/ogham/template/thymeleaf/v2/adapter/ThymeleafV2TemplateOptionsApplier::set → RUN_ERROR

30

1.1
Location : set
Killed by :
negated conditional → RUN_ERROR

31

1.1
Location : set
Killed by :
removed call to java/util/function/Consumer::accept → RUN_ERROR

Active mutators

Tests examined


Report generated by PIT 1.13.1