ActivableAtRuntimeConditionProvider.java

1
package fr.sii.ogham.core.condition.provider;
2
3
import fr.sii.ogham.core.builder.ActivableAtRuntime;
4
import fr.sii.ogham.core.condition.Condition;
5
import fr.sii.ogham.core.condition.FixedCondition;
6
import fr.sii.ogham.core.message.Message;
7
8
/**
9
 * If the source object implements {@link ActivableAtRuntime}, then this
10
 * provider returns directly the condition of
11
 * {@link ActivableAtRuntime#getCondition()}.
12
 * 
13
 * <p>
14
 * If the object doesn't implement {@link ActivableAtRuntime}, then returns a
15
 * condition that is always true.
16
 * </p>
17
 * 
18
 * @author Aurélien Baudet
19
 *
20
 */
21
public class ActivableAtRuntimeConditionProvider implements ConditionProvider<Object, Message> {
22
23
	@Override
24
	public Condition<Message> provide(Object source) {
25 1 1. provide : negated conditional → RUN_ERROR
		if (source instanceof ActivableAtRuntime) {
26 1 1. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/ActivableAtRuntimeConditionProvider::provide → NO_COVERAGE
			return ((ActivableAtRuntime) source).getCondition();
27
		}
28 1 1. provide : replaced return value with null for fr/sii/ogham/core/condition/provider/ActivableAtRuntimeConditionProvider::provide → RUN_ERROR
		return new FixedCondition<>(true);
29
	}
30
31
}

Mutations

25

1.1
Location : provide
Killed by :
negated conditional → RUN_ERROR

26

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

28

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

Active mutators

Tests examined


Report generated by PIT 1.13.1