CompositeCondition.java

1
package fr.sii.ogham.core.condition;
2
3
import java.util.ArrayList;
4
import java.util.Arrays;
5
import java.util.List;
6
7
import fr.sii.ogham.core.util.EqualsBuilder;
8
import fr.sii.ogham.core.util.HashCodeBuilder;
9
10
/**
11
 * Base class for operators that handle several sub-conditions like AND operator
12
 * and OR operator.
13
 * 
14
 * @author Aurélien Baudet
15
 *
16
 * @param <T>
17
 *            the type of the object to test
18
 */
19
public abstract class CompositeCondition<T> implements Condition<T> {
20
	protected final List<Condition<T>> conditions;
21
22
	protected CompositeCondition(List<Condition<T>> conditions) {
23
		super();
24
		this.conditions = conditions;
25
	}
26
27
	@SafeVarargs
28
	protected CompositeCondition(Condition<T>... conditions) {
29
		this(new ArrayList<>(Arrays.asList(conditions)));
30
	}
31
32
	protected List<Condition<T>> getConditions() {
33 7 1. getConditions : replaced return value with Collections.emptyList for fr/sii/ogham/core/condition/CompositeCondition::getConditions → NO_COVERAGE
2. getConditions : replaced return value with Collections.emptyList for fr/sii/ogham/core/condition/CompositeCondition::getConditions → SURVIVED
3. getConditions : replaced return value with Collections.emptyList for fr/sii/ogham/core/condition/CompositeCondition::getConditions → TIMED_OUT
4. getConditions : replaced return value with Collections.emptyList for fr/sii/ogham/core/condition/CompositeCondition::getConditions → KILLED
5. getConditions : replaced return value with Collections.emptyList for fr/sii/ogham/core/condition/CompositeCondition::getConditions → KILLED
6. getConditions : replaced return value with Collections.emptyList for fr/sii/ogham/core/condition/CompositeCondition::getConditions → KILLED
7. getConditions : replaced return value with Collections.emptyList for fr/sii/ogham/core/condition/CompositeCondition::getConditions → KILLED
		return conditions;
34
	}
35
36
	protected CompositeCondition<T> addCondition(Condition<T> condition) {
37
		conditions.add(condition);
38 3 1. addCondition : replaced return value with null for fr/sii/ogham/core/condition/CompositeCondition::addCondition → NO_COVERAGE
2. addCondition : replaced return value with null for fr/sii/ogham/core/condition/CompositeCondition::addCondition → SURVIVED
3. addCondition : replaced return value with null for fr/sii/ogham/core/condition/CompositeCondition::addCondition → TIMED_OUT
		return this;
39
	}
40
41
	protected CompositeCondition<T> addConditions(List<Condition<T>> conditions) {
42
		this.conditions.addAll(conditions);
43 1 1. addConditions : replaced return value with null for fr/sii/ogham/core/condition/CompositeCondition::addConditions → NO_COVERAGE
		return this;
44
	}
45
46
	@Override
47
	public boolean equals(Object obj) {
48 2 1. equals : replaced boolean return with false for fr/sii/ogham/core/condition/CompositeCondition::equals → NO_COVERAGE
2. equals : replaced boolean return with true for fr/sii/ogham/core/condition/CompositeCondition::equals → NO_COVERAGE
		return new EqualsBuilder(this, obj).appendFields("conditions").isEqual();
49
	}
50
51
	@Override
52
	public int hashCode() {
53 1 1. hashCode : replaced int return with 0 for fr/sii/ogham/core/condition/CompositeCondition::hashCode → NO_COVERAGE
		return new HashCodeBuilder().append(conditions).hashCode();
54
	}
55
56
	@Override
57
	public String toString() {
58 1 1. toString : replaced return value with "" for fr/sii/ogham/core/condition/CompositeCondition::toString → NO_COVERAGE
		return conditions.toString();
59
	}
60
61
}

Mutations

33

1.1
Location : getConditions
Killed by : oghamspringbootv1autoconfigure.it.SpringBeanResolutionTest.missingBeanErrorUsingThymeleaf(oghamspringbootv1autoconfigure.it.SpringBeanResolutionTest)
replaced return value with Collections.emptyList for fr/sii/ogham/core/condition/CompositeCondition::getConditions → KILLED

2.2
Location : getConditions
Killed by : none
replaced return value with Collections.emptyList for fr/sii/ogham/core/condition/CompositeCondition::getConditions → NO_COVERAGE

3.3
Location : getConditions
Killed by : oghamjavamail.it.builder.JavaMailCustomConfigurationTest.noHostDefinedShouldFail(oghamjavamail.it.builder.JavaMailCustomConfigurationTest)
replaced return value with Collections.emptyList for fr/sii/ogham/core/condition/CompositeCondition::getConditions → KILLED

4.4
Location : getConditions
Killed by : oghamall.it.email.EmailCustomImplTest.simple(oghamall.it.email.EmailCustomImplTest)
replaced return value with Collections.emptyList for fr/sii/ogham/core/condition/CompositeCondition::getConditions → KILLED

5.5
Location : getConditions
Killed by : oghamcore.ut.core.condition.fluent.FluentConditionsTest.requiredMailHostAndMailPortProperties(oghamcore.ut.core.condition.fluent.FluentConditionsTest)
replaced return value with Collections.emptyList for fr/sii/ogham/core/condition/CompositeCondition::getConditions → KILLED

6.6
Location : getConditions
Killed by : none
replaced return value with Collections.emptyList for fr/sii/ogham/core/condition/CompositeCondition::getConditions → TIMED_OUT

7.7
Location : getConditions
Killed by : none
replaced return value with Collections.emptyList for fr/sii/ogham/core/condition/CompositeCondition::getConditions → SURVIVED

38

1.1
Location : addCondition
Killed by : none
replaced return value with null for fr/sii/ogham/core/condition/CompositeCondition::addCondition → TIMED_OUT

2.2
Location : addCondition
Killed by : none
replaced return value with null for fr/sii/ogham/core/condition/CompositeCondition::addCondition → NO_COVERAGE

3.3
Location : addCondition
Killed by : none
replaced return value with null for fr/sii/ogham/core/condition/CompositeCondition::addCondition → SURVIVED

43

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

48

1.1
Location : equals
Killed by : none
replaced boolean return with false for fr/sii/ogham/core/condition/CompositeCondition::equals → NO_COVERAGE

2.2
Location : equals
Killed by : none
replaced boolean return with true for fr/sii/ogham/core/condition/CompositeCondition::equals → NO_COVERAGE

53

1.1
Location : hashCode
Killed by : none
replaced int return with 0 for fr/sii/ogham/core/condition/CompositeCondition::hashCode → NO_COVERAGE

58

1.1
Location : toString
Killed by : none
replaced return value with "" for fr/sii/ogham/core/condition/CompositeCondition::toString → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT OGHAM