1
|
|
package fr.sii.ogham.core.condition.provider; |
2
|
|
|
3
|
|
import static fr.sii.ogham.core.condition.fluent.Conditions.alwaysTrue; |
4
|
|
import static fr.sii.ogham.core.condition.fluent.Conditions.not; |
5
|
|
import static fr.sii.ogham.core.condition.fluent.Conditions.requiredClass; |
6
|
|
|
7
|
|
import fr.sii.ogham.core.builder.condition.RequiredClass; |
8
|
|
import fr.sii.ogham.core.condition.Condition; |
9
|
|
import fr.sii.ogham.core.condition.fluent.Conditions; |
10
|
|
import fr.sii.ogham.core.condition.fluent.FluentCondition; |
11
|
|
|
12
|
|
/** |
13
|
|
* Provider that handle {@link RequiredClass} annotation to provide a condition. |
14
|
|
* |
15
|
|
* @author Aurélien Baudet |
16
|
|
* |
17
|
|
* @param <T> |
18
|
|
* the kind of the object under conditions |
19
|
|
*/ |
20
|
|
public class RequiredClassAnnotationProvider<T> implements ConditionProvider<RequiredClass, T> { |
21
|
|
|
22
|
|
@Override |
23
|
|
public Condition<T> provide(RequiredClass annotation) { |
24
|
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) { |
25
|
8
1. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::provide → SURVIVED
2. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::provide → NO_COVERAGE
3. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::provide → TIMED_OUT
4. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::provide → KILLED
5. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::provide → KILLED
6. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::provide → KILLED
7. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::provide → KILLED
8. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::provide → KILLED
|
return alwaysTrue(); |
26
|
|
} else { |
27
|
|
FluentCondition<T> mainCondition = classNameOrAlternatives(annotation); |
28
|
|
for (String exclude : annotation.excludes()) { |
29
|
|
mainCondition = mainCondition.and(not(Conditions.<T> requiredClass(exclude))); |
30
|
|
} |
31
|
2
1. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::provide → NO_COVERAGE
2. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::provide → KILLED
|
return mainCondition; |
32
|
|
} |
33
|
|
} |
34
|
|
|
35
|
|
private FluentCondition<T> classNameOrAlternatives(RequiredClass annotation) { |
36
|
|
FluentCondition<T> condition = requiredClass(annotation.value()); |
37
|
|
for (String alternative : annotation.alternatives()) { |
38
|
|
condition = condition.or(Conditions.<T> requiredClass(alternative)); |
39
|
|
} |
40
|
2
1. classNameOrAlternatives : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::classNameOrAlternatives → NO_COVERAGE
2. classNameOrAlternatives : replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::classNameOrAlternatives → KILLED
|
return condition; |
41
|
|
} |
42
|
|
|
43
|
|
} |
| | Mutations |
24 |
|
1.1 Location : provide Killed by : none negated conditional → NO_COVERAGE 2.2 Location : provide Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec negated conditional → KILLED 3.3 Location : provide Killed by : oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests.oghamPropertiesWithSpringPropsShouldUseOghamPropertiesPrecedence(oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests) negated conditional → KILLED 4.4 Location : provide Killed by : oghamall.it.configuration.EmptyBuilderTest.emailSenderManuallyRegisteredButUnconfiguredTemplateParsersCantHandleMultiTemplateContent(oghamall.it.configuration.EmptyBuilderTest) negated conditional → KILLED 5.5 Location : provide Killed by : oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests.oghamAloneShouldUseOghamProperties(oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests) negated conditional → KILLED 6.6 Location : provide Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest) negated conditional → KILLED 7.7 Location : provide Killed by : oghamcore.ut.core.condition.provider.RequiredClassesAnnotationProviderTest.oneRequiredClassWithExcludes(oghamcore.ut.core.condition.provider.RequiredClassesAnnotationProviderTest) negated conditional → KILLED 8.8 Location : provide Killed by : oghamjavamail.it.builder.JavaMailCustomConfigurationTest.noHostDefinedShouldFail(oghamjavamail.it.builder.JavaMailCustomConfigurationTest) negated conditional → KILLED
|
25 |
|
1.1 Location : provide Killed by : none replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::provide → SURVIVED 2.2 Location : provide Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest) replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::provide → KILLED 3.3 Location : provide Killed by : none replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::provide → TIMED_OUT 4.4 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/RequiredClassAnnotationProvider::provide → KILLED 5.5 Location : provide Killed by : oghamcore.it.core.service.CleanupTest.manualCleanupShouldAutomaticallyCleanTheSenders(oghamcore.it.core.service.CleanupTest) replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::provide → KILLED 6.6 Location : provide Killed by : oghamspringbootv1autoconfigure.it.SpringBeanResolutionTest.missingBeanErrorUsingThymeleaf(oghamspringbootv1autoconfigure.it.SpringBeanResolutionTest) replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::provide → KILLED 7.7 Location : provide Killed by : none replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::provide → NO_COVERAGE 8.8 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/RequiredClassAnnotationProvider::provide → KILLED
|
31 |
|
1.1 Location : provide Killed by : none replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::provide → NO_COVERAGE 2.2 Location : provide Killed by : oghamcore.ut.core.condition.provider.RequiredClassesAnnotationProviderTest.oneRequiredClassWithExcludes(oghamcore.ut.core.condition.provider.RequiredClassesAnnotationProviderTest) replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::provide → KILLED
|
40 |
|
1.1 Location : classNameOrAlternatives Killed by : none replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::classNameOrAlternatives → NO_COVERAGE 2.2 Location : classNameOrAlternatives Killed by : oghamcore.ut.core.condition.provider.RequiredClassesAnnotationProviderTest.oneRequiredClassWithExcludes(oghamcore.ut.core.condition.provider.RequiredClassesAnnotationProviderTest) replaced return value with null for fr/sii/ogham/core/condition/provider/RequiredClassAnnotationProvider::classNameOrAlternatives → KILLED
|