FixedCondition.java

1
package fr.sii.ogham.core.condition;
2
3
import fr.sii.ogham.core.util.EqualsBuilder;
4
import fr.sii.ogham.core.util.HashCodeBuilder;
5
6
/**
7
 * Basic condition that always give the same result: the result you provided at
8
 * construction.
9
 * 
10
 * @author Aurélien Baudet
11
 *
12
 * @param <T>
13
 *            the type of the object to test
14
 */
15
public class FixedCondition<T> implements Condition<T> {
16
	private final boolean accept;
17
18
	/**
19
	 * Initializes with the value that will always be returned when calling
20
	 * {@link #accept(Object)}.
21
	 * 
22
	 * @param accept
23
	 *            true to always accept, false to always reject
24
	 */
25
	public FixedCondition(boolean accept) {
26
		super();
27
		this.accept = accept;
28
	}
29
30
	@Override
31
	public boolean accept(T obj) {
32 10 1. accept : replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::accept → NO_COVERAGE
2. accept : replaced boolean return with true for fr/sii/ogham/core/condition/FixedCondition::accept → SURVIVED
3. accept : replaced boolean return with true for fr/sii/ogham/core/condition/FixedCondition::accept → NO_COVERAGE
4. accept : replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::accept → TIMED_OUT
5. accept : replaced boolean return with true for fr/sii/ogham/core/condition/FixedCondition::accept → TIMED_OUT
6. accept : replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::accept → KILLED
7. accept : replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::accept → KILLED
8. accept : replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::accept → KILLED
9. accept : replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::accept → KILLED
10. accept : replaced boolean return with true for fr/sii/ogham/core/condition/FixedCondition::accept → KILLED
		return accept;
33
	}
34
35
	@Override
36
	public boolean equals(Object obj) {
37 2 1. equals : replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::equals → NO_COVERAGE
2. equals : replaced boolean return with true for fr/sii/ogham/core/condition/FixedCondition::equals → NO_COVERAGE
		return new EqualsBuilder(this, obj).appendFields("accept").isEqual();
38
	}
39
40
	@Override
41
	public int hashCode() {
42 1 1. hashCode : replaced int return with 0 for fr/sii/ogham/core/condition/FixedCondition::hashCode → NO_COVERAGE
		return new HashCodeBuilder().append(accept).hashCode();
43
	}
44
45
	@Override
46
	public String toString() {
47
		StringBuilder builder = new StringBuilder();
48
		builder.append(accept);
49 1 1. toString : replaced return value with "" for fr/sii/ogham/core/condition/FixedCondition::toString → NO_COVERAGE
		return builder.toString();
50
	}
51
}

Mutations

32

1.1
Location : accept
Killed by : oghamcore.ut.core.condition.provider.RequiredClassesAnnotationProviderTest.nothingSpecified(oghamcore.ut.core.condition.provider.RequiredClassesAnnotationProviderTest)
replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::accept → KILLED

2.2
Location : accept
Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest)
replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::accept → KILLED

3.3
Location : accept
Killed by : none
replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::accept → NO_COVERAGE

4.4
Location : accept
Killed by : none
replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::accept → TIMED_OUT

5.5
Location : accept
Killed by : oghamjavamail.it.builder.JavaMailCustomConfigurationTest.oghamPropertyShouldOverride(oghamjavamail.it.builder.JavaMailCustomConfigurationTest)
replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::accept → KILLED

6.6
Location : accept
Killed by : oghamall.it.configuration.EmptyBuilderTest.emailSenderManuallyRegisteredButUnconfiguredTemplateParsersCantHandleMultiTemplateContent(oghamall.it.configuration.EmptyBuilderTest)
replaced boolean return with false for fr/sii/ogham/core/condition/FixedCondition::accept → KILLED

7.7
Location : accept
Killed by : none
replaced boolean return with true for fr/sii/ogham/core/condition/FixedCondition::accept → SURVIVED

8.8
Location : accept
Killed by : none
replaced boolean return with true for fr/sii/ogham/core/condition/FixedCondition::accept → NO_COVERAGE

9.9
Location : accept
Killed by : none
replaced boolean return with true for fr/sii/ogham/core/condition/FixedCondition::accept → TIMED_OUT

10.10
Location : accept
Killed by : oghamcore.it.core.condition.MessageConditionsSpec
replaced boolean return with true for fr/sii/ogham/core/condition/FixedCondition::accept → KILLED

37

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

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

42

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

49

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

Active mutators

Tests examined


Report generated by PIT OGHAM