ThymeleafV3SmsBuilder.java

1
package fr.sii.ogham.template.thymeleaf.v3.buider;
2
3
import org.thymeleaf.TemplateEngine;
4
import org.thymeleaf.templateresolver.ITemplateResolver;
5
6
import fr.sii.ogham.core.builder.context.BuildContext;
7
import fr.sii.ogham.core.builder.env.EnvironmentBuilder;
8
import fr.sii.ogham.core.template.detector.TemplateEngineDetector;
9
import fr.sii.ogham.sms.builder.SmsBuilder;
10
import fr.sii.ogham.template.thymeleaf.common.adapter.ClassPathResolverAdapter;
11
import fr.sii.ogham.template.thymeleaf.common.adapter.FileResolverAdapter;
12
import fr.sii.ogham.template.thymeleaf.common.adapter.FirstSupportingResolverAdapter;
13
import fr.sii.ogham.template.thymeleaf.common.adapter.TemplateResolverAdapter;
14
import fr.sii.ogham.template.thymeleaf.common.buider.AbstractThymeleafBuilder;
15
import fr.sii.ogham.template.thymeleaf.v3.ThymeLeafV3FirstSupportingTemplateResolver;
16
import fr.sii.ogham.template.thymeleaf.v3.ThymeleafV3TemplateDetector;
17
import fr.sii.ogham.template.thymeleaf.v3.adapter.StringResolverAdapter;
18
import fr.sii.ogham.template.thymeleaf.v3.adapter.ThymeleafV3TemplateOptionsApplier;
19
20
/**
21
 * Configures parsing of templates using Thymeleaf.
22
 * 
23
 * Specific resource resolution can be configured to use template prefix/suffix
24
 * paths:
25
 * 
26
 * <pre>
27
 * <code>
28
 * .classpath()
29
 *   .pathPrefix("email/")
30
 *   .pathSuffix(".html")
31
 *   .and()
32
 * .file()
33
 *   .pathPrefix("/data/myapplication/templates/email")
34
 *   .pathSuffix(".html")
35
 * </code>
36
 * </pre>
37
 * 
38
 * You can customize default Thymeleaf {@link TemplateEngine}:
39
 * 
40
 * <pre>
41
 * <code>
42
 * .engine()
43
 *   .addDialect("foo", myDialect)
44
 *   .addMessageResolver(myMessageResolver)
45
 * </code>
46
 * </pre>
47
 * 
48
 * Or you can use a particular Thymeleaf {@link TemplateEngine}:
49
 * 
50
 * <pre>
51
 * <code>
52
 * .engine(new MyTemplateEngine())
53
 * </code>
54
 * </pre>
55
 * 
56
 * @author Aurélien Baudet
57
 *
58
 */
59
public class ThymeleafV3SmsBuilder extends AbstractThymeleafBuilder<ThymeleafV3SmsBuilder, SmsBuilder, ThymeleafV3EngineConfigBuilder<ThymeleafV3SmsBuilder>> {
60
	/**
61
	 * Default constructor when using Thymeleaf without all Ogham work.
62
	 * 
63
	 * <strong>WARNING: use is only if you know what you are doing !</strong>
64
	 */
65
	public ThymeleafV3SmsBuilder() {
66
		super(ThymeleafV3SmsBuilder.class);
67
	}
68
69
	/**
70
	 * Initializes the builder with a parent builder. The parent builder is used
71
	 * when calling {@link #and()} method. The {@link EnvironmentBuilder} is
72
	 * used to evaluate properties when {@link #build()} method is called.
73
	 * 
74
	 * @param parent
75
	 *            the parent builder
76
	 * @param buildContext
77
	 *            for registering instances and property evaluation
78
	 */
79
	public ThymeleafV3SmsBuilder(SmsBuilder parent, BuildContext buildContext) {
80
		super(ThymeleafV3SmsBuilder.class, parent, buildContext);
81
	}
82
83
	@Override
84
	protected TemplateEngineDetector createTemplateDetector() {
85 4 1. createTemplateDetector : replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::createTemplateDetector → NO_COVERAGE
2. createTemplateDetector : replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::createTemplateDetector → KILLED
3. createTemplateDetector : replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::createTemplateDetector → KILLED
4. createTemplateDetector : replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::createTemplateDetector → KILLED
		return buildContext.register(new ThymeleafV3TemplateDetector(buildResolver()));
86
	}
87
88
	@Override
89
	protected ITemplateResolver buildTemplateResolver(TemplateEngine builtEngine) {
90 4 1. buildTemplateResolver : replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::buildTemplateResolver → NO_COVERAGE
2. buildTemplateResolver : replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::buildTemplateResolver → KILLED
3. buildTemplateResolver : replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::buildTemplateResolver → KILLED
4. buildTemplateResolver : replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::buildTemplateResolver → KILLED
		return buildContext.register(new ThymeLeafV3FirstSupportingTemplateResolver(buildResolver(), buildAdapters()));
91
	}
92
93
	@Override
94
	protected ThymeleafV3EngineConfigBuilder<ThymeleafV3SmsBuilder> getThymeleafEngineConfigBuilder() {
95 1 1. getThymeleafEngineConfigBuilder : replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::getThymeleafEngineConfigBuilder → NO_COVERAGE
		return buildContext.register(new ThymeleafV3EngineConfigBuilder<>(myself, buildContext));
96
	}
97
98
	@Override
99
	protected FirstSupportingResolverAdapter buildAdapters() {
100
		FirstSupportingResolverAdapter adapter = buildContext.register(new FirstSupportingResolverAdapter());
101
		for (TemplateResolverAdapter custom : customAdapters) {
102 1 1. buildAdapters : removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → NO_COVERAGE
			adapter.addAdapter(custom);
103
		}
104
		ThymeleafV3TemplateOptionsApplier applier = buildContext.register(new ThymeleafV3TemplateOptionsApplier());
105 4 1. buildAdapters : removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → NO_COVERAGE
2. buildAdapters : removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → SURVIVED
3. buildAdapters : removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → KILLED
4. buildAdapters : removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → KILLED
		adapter.addAdapter(buildContext.register(new ClassPathResolverAdapter(applier)));
106 2 1. buildAdapters : removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → SURVIVED
2. buildAdapters : removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → NO_COVERAGE
		adapter.addAdapter(buildContext.register(new FileResolverAdapter(applier)));
107 4 1. buildAdapters : removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → NO_COVERAGE
2. buildAdapters : removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → SURVIVED
3. buildAdapters : removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → KILLED
4. buildAdapters : removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → KILLED
		adapter.addAdapter(buildContext.register(new StringResolverAdapter(applier)));
108 4 1. buildAdapters : removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::setOptions → SURVIVED
2. buildAdapters : removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::setOptions → NO_COVERAGE
3. buildAdapters : removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::setOptions → KILLED
4. buildAdapters : removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::setOptions → KILLED
		adapter.setOptions(buildTemplateResolverOptions());
109 4 1. buildAdapters : replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::buildAdapters → NO_COVERAGE
2. buildAdapters : replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::buildAdapters → SURVIVED
3. buildAdapters : replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::buildAdapters → KILLED
4. buildAdapters : replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::buildAdapters → KILLED
		return adapter;
110
	}
111
}

Mutations

85

1.1
Location : createTemplateDetector
Killed by : oghamthymeleafv3.it.ThymeleafDetectorTest.notFound(oghamthymeleafv3.it.ThymeleafDetectorTest)
replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::createTemplateDetector → KILLED

2.2
Location : createTemplateDetector
Killed by : oghamall.it.freemarker.StaticMethodAccessDisabledTest.smsUsingFreemarkerTemplateAndStaticMethodAccessDisabledShouldFail(oghamall.it.freemarker.StaticMethodAccessDisabledTest)
replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::createTemplateDetector → KILLED

3.3
Location : createTemplateDetector
Killed by : oghamspringbootv2autoconfigure.it.StaticMethodAccessTest.smsUsingFreemarkerTemplateAndStaticMethodAccessDisabledShouldFail(oghamspringbootv2autoconfigure.it.StaticMethodAccessTest)
replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::createTemplateDetector → KILLED

4.4
Location : createTemplateDetector
Killed by : none
replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::createTemplateDetector → NO_COVERAGE

90

1.1
Location : buildTemplateResolver
Killed by : none
replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::buildTemplateResolver → NO_COVERAGE

2.2
Location : buildTemplateResolver
Killed by : oghamall.it.optional.ImplementationSelectionTests.javaMailAvailable(oghamall.it.optional.ImplementationSelectionTests)
replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::buildTemplateResolver → KILLED

3.3
Location : buildTemplateResolver
Killed by : oghamthymeleafv3.it.ThymeleafParserTest.invalid(oghamthymeleafv3.it.ThymeleafParserTest)
replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::buildTemplateResolver → KILLED

4.4
Location : buildTemplateResolver
Killed by : oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests.oghamPropertiesWithSpringPropsShouldUseOghamPropertiesPrecedence(oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests)
replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::buildTemplateResolver → KILLED

95

1.1
Location : getThymeleafEngineConfigBuilder
Killed by : none
replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::getThymeleafEngineConfigBuilder → NO_COVERAGE

102

1.1
Location : buildAdapters
Killed by : none
removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → NO_COVERAGE

105

1.1
Location : buildAdapters
Killed by : none
removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → NO_COVERAGE

2.2
Location : buildAdapters
Killed by : oghamthymeleafv3.it.ThymeleafParserTest.html(oghamthymeleafv3.it.ThymeleafParserTest)
removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → KILLED

3.3
Location : buildAdapters
Killed by : none
removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → SURVIVED

4.4
Location : buildAdapters
Killed by : oghamall.it.thymeleaf.StaticMethodAccessTest.smsUsingThymeleafTemplateShouldBeAbleToCallStaticMethods(oghamall.it.thymeleaf.StaticMethodAccessTest)
removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → KILLED

106

1.1
Location : buildAdapters
Killed by : none
removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → SURVIVED

2.2
Location : buildAdapters
Killed by : none
removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → NO_COVERAGE

107

1.1
Location : buildAdapters
Killed by : none
removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → NO_COVERAGE

2.2
Location : buildAdapters
Killed by : none
removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → SURVIVED

3.3
Location : buildAdapters
Killed by : oghamthymeleafv3.it.resolver.StringResourceResolverTest.text(oghamthymeleafv3.it.resolver.StringResourceResolverTest)
removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → KILLED

4.4
Location : buildAdapters
Killed by : oghamall.it.sms.FluentSmsTest.useTemplateString(oghamall.it.sms.FluentSmsTest)
removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::addAdapter → KILLED

108

1.1
Location : buildAdapters
Killed by : none
removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::setOptions → SURVIVED

2.2
Location : buildAdapters
Killed by : none
removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::setOptions → NO_COVERAGE

3.3
Location : buildAdapters
Killed by : oghamthymeleafv3.it.ThymeleafParserTest.html(oghamthymeleafv3.it.ThymeleafParserTest)
removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::setOptions → KILLED

4.4
Location : buildAdapters
Killed by : oghamall.it.thymeleaf.StaticMethodAccessTest.smsUsingThymeleafTemplateShouldBeAbleToCallStaticMethods(oghamall.it.thymeleaf.StaticMethodAccessTest)
removed call to fr/sii/ogham/template/thymeleaf/common/adapter/FirstSupportingResolverAdapter::setOptions → KILLED

109

1.1
Location : buildAdapters
Killed by : none
replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::buildAdapters → NO_COVERAGE

2.2
Location : buildAdapters
Killed by : none
replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::buildAdapters → SURVIVED

3.3
Location : buildAdapters
Killed by : oghamall.it.thymeleaf.StaticMethodAccessTest.smsUsingThymeleafTemplateShouldBeAbleToCallStaticMethods(oghamall.it.thymeleaf.StaticMethodAccessTest)
replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::buildAdapters → KILLED

4.4
Location : buildAdapters
Killed by : oghamthymeleafv3.it.resolver.StringResourceResolverTest.text(oghamthymeleafv3.it.resolver.StringResourceResolverTest)
replaced return value with null for fr/sii/ogham/template/thymeleaf/v3/buider/ThymeleafV3SmsBuilder::buildAdapters → KILLED

Active mutators

Tests examined


Report generated by PIT OGHAM