RequiredClassesAnnotationProvider.java

1
package fr.sii.ogham.core.condition.provider;
2
3
import fr.sii.ogham.core.builder.condition.RequiredClass;
4
import fr.sii.ogham.core.builder.condition.RequiredClasses;
5
import fr.sii.ogham.core.condition.AndCondition;
6
import fr.sii.ogham.core.condition.Condition;
7
import fr.sii.ogham.core.condition.FixedCondition;
8
import fr.sii.ogham.core.condition.fluent.Conditions;
9
10
/**
11
 * Provider that handle {@link RequiredClasses} annotation to provide a
12
 * condition.
13
 * 
14
 * It delegates handling of {@link RequiredClass} to
15
 * {@link RequiredClassAnnotationProvider}.
16
 * 
17
 * @author Aurélien Baudet
18
 *
19
 * @param <T>
20
 *            the kind of the object under conditions
21
 */
22
public class RequiredClassesAnnotationProvider<T> implements ConditionProvider<RequiredClasses, T> {
23
	private final RequiredClassAnnotationProvider<T> delegate;
24
25
	public RequiredClassesAnnotationProvider() {
26
		super();
27
		this.delegate = new RequiredClassAnnotationProvider<>();
28
	}
29
30
	@Override
31
	public Condition<T> provide(RequiredClasses annotation) {
32 8 1. provide : negated conditional → NO_COVERAGE
2. provide : negated conditional → KILLED
3. provide : negated conditional → KILLED
4. provide : negated conditional → KILLED
5. provide : negated conditional → KILLED
6. provide : negated conditional → KILLED
7. provide : negated conditional → KILLED
8. provide : negated conditional → KILLED
		if (annotation == null) {
33 8 1. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → SURVIVED
2. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → NO_COVERAGE
3. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → KILLED
4. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → KILLED
5. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → KILLED
6. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → KILLED
7. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → KILLED
8. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → KILLED
			return new FixedCondition<>(true);
34
		} else {
35
			AndCondition<T> mainCondition = new AndCondition<>();
36
			for (String requiredClassName : annotation.value()) {
37
				mainCondition = mainCondition.and(Conditions.<T> requiredClass(requiredClassName));
38
			}
39
			for (RequiredClass subAnnotation : annotation.classes()) {
40
				mainCondition = mainCondition.and(delegate.provide(subAnnotation));
41
			}
42 2 1. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → NO_COVERAGE
2. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → KILLED
			return mainCondition;
43
		}
44
	}
45
46
}

Mutations

32

1.1
Location : provide
Killed by : oghamall.it.configuration.EmptyBuilderTest.emailSenderManuallyRegisteredButUnconfiguredTemplateParsersCantHandleMultiTemplateContent(oghamall.it.configuration.EmptyBuilderTest)
negated conditional → KILLED

2.2
Location : provide
Killed by : oghamjavamail.it.builder.JavaMailCustomConfigurationTest.noHostDefinedShouldFail(oghamjavamail.it.builder.JavaMailCustomConfigurationTest)
negated conditional → KILLED

3.3
Location : provide
Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec
negated conditional → KILLED

4.4
Location : provide
Killed by : oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests.oghamPropertiesWithSpringPropsShouldUseOghamPropertiesPrecedence(oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests)
negated conditional → KILLED

5.5
Location : provide
Killed by : oghamcore.ut.core.condition.provider.RequiredClassesAnnotationProviderTest.singleRequiredClass(oghamcore.ut.core.condition.provider.RequiredClassesAnnotationProviderTest)
negated conditional → KILLED

6.6
Location : provide
Killed by : none
negated conditional → NO_COVERAGE

7.7
Location : provide
Killed by : oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests.oghamAloneShouldUseOghamProperties(oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests)
negated conditional → KILLED

8.8
Location : provide
Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest)
negated conditional → KILLED

33

1.1
Location : provide
Killed by : none
replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → SURVIVED

2.2
Location : provide
Killed by : oghamcore.ut.core.condition.provider.RequiredClassesAnnotationProviderTest.nothingSpecified(oghamcore.ut.core.condition.provider.RequiredClassesAnnotationProviderTest)
replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → KILLED

3.3
Location : provide
Killed by : oghamspringbootv2autoconfigure.it.StaticMethodAccessTest.emailUsingFreemarkerTemplateAndStaticMethodAccessDisabledShouldFail(oghamspringbootv2autoconfigure.it.StaticMethodAccessTest)
replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → KILLED

4.4
Location : provide
Killed by : oghamspringbootv1autoconfigure.it.SpringBeanResolutionTest.missingBeanErrorUsingThymeleaf(oghamspringbootv1autoconfigure.it.SpringBeanResolutionTest)
replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → KILLED

5.5
Location : provide
Killed by : oghamall.it.configuration.EmptyBuilderTest.emailSenderManuallyRegisteredButUnconfiguredTemplateParsersCantHandleMultiTemplateContent(oghamall.it.configuration.EmptyBuilderTest)
replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → KILLED

6.6
Location : provide
Killed by : oghamjavamail.it.builder.JavaMailCustomConfigurationTest.noHostDefinedShouldFail(oghamjavamail.it.builder.JavaMailCustomConfigurationTest)
replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → KILLED

7.7
Location : provide
Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest)
replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → KILLED

8.8
Location : provide
Killed by : none
replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → NO_COVERAGE

42

1.1
Location : provide
Killed by : none
replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → NO_COVERAGE

2.2
Location : provide
Killed by : oghamcore.ut.core.condition.provider.RequiredClassesAnnotationProviderTest.singleRequiredClass(oghamcore.ut.core.condition.provider.RequiredClassesAnnotationProviderTest)
replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassesAnnotationProvider::provide → KILLED

Active mutators

Tests examined


Report generated by PIT OGHAM