CustomReason.java

1
package fr.sii.ogham.testing.assertion.hamcrest;
2
3
import org.hamcrest.BaseMatcher;
4
import org.hamcrest.Description;
5
import org.hamcrest.Matcher;
6
7
/**
8
 * Decorates a Hamcrest matcher in order to provide a different reason.
9
 * 
10
 * @author Aurélien Baudet
11
 *
12
 * @param <T>
13
 *            the type of the actual value
14
 */
15
public class CustomReason<T> extends BaseMatcher<T> implements DecoratorMatcher<T> {
16
	private final String reason;
17
	private final Matcher<T> matcher;
18
19
	public CustomReason(String reason, Matcher<T> matcher) {
20
		super();
21
		this.reason = reason;
22
		this.matcher = matcher;
23
	}
24
25
	@Override
26
	public boolean matches(Object item) {
27 10 1. matches : replaced boolean return with false for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → NO_COVERAGE
2. matches : replaced boolean return with true for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → NO_COVERAGE
3. matches : replaced boolean return with true for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → SURVIVED
4. matches : replaced boolean return with false for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → TIMED_OUT
5. matches : replaced boolean return with true for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → TIMED_OUT
6. matches : replaced boolean return with false for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → KILLED
7. matches : replaced boolean return with false for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → KILLED
8. matches : replaced boolean return with false for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → KILLED
9. matches : replaced boolean return with false for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → KILLED
10. matches : replaced boolean return with true for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → KILLED
		return matcher.matches(item);
28
	}
29
30
	@Override
31
	public void describeTo(Description description) {
32 2 1. describeTo : removed call to org/hamcrest/Matcher::describeTo → NO_COVERAGE
2. describeTo : removed call to org/hamcrest/Matcher::describeTo → KILLED
		matcher.describeTo(description);
33
	}
34
35
	public String getReason() {
36 2 1. getReason : replaced return value with "" for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::getReason → NO_COVERAGE
2. getReason : replaced return value with "" for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::getReason → KILLED
		return reason;
37
	}
38
39
	public Matcher<T> getDecoree() {
40 2 1. getDecoree : replaced return value with null for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::getDecoree → NO_COVERAGE
2. getDecoree : replaced return value with null for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::getDecoree → KILLED
		return matcher;
41
	}
42
43
}

Mutations

27

1.1
Location : matches
Killed by : oghamjavamail.it.JavaMailSmtpTest.simple(oghamjavamail.it.JavaMailSmtpTest)
replaced boolean return with false for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → KILLED

2.2
Location : matches
Killed by : oghamtesting.it.assertion.FluentSmsAssertionsSpec
replaced boolean return with false for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → KILLED

3.3
Location : matches
Killed by : none
replaced boolean return with false for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → TIMED_OUT

4.4
Location : matches
Killed by : none
replaced boolean return with false for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → NO_COVERAGE

5.5
Location : matches
Killed by : oghamall.it.configuration.EmptyBuilderTest.manualJavaMailConfigurationCanSendEmail(oghamall.it.configuration.EmptyBuilderTest)
replaced boolean return with false for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → KILLED

6.6
Location : matches
Killed by : oghamcloudhopper.it.PartialConfigurationTest.nothingConfiguredAndLongMessageShouldSendOneLongMessageUsingDefaultEncoding(oghamcloudhopper.it.PartialConfigurationTest)
replaced boolean return with false for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → KILLED

7.7
Location : matches
Killed by : none
replaced boolean return with true for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → TIMED_OUT

8.8
Location : matches
Killed by : oghamtesting.it.assertion.AssertionHelperSpec
replaced boolean return with true for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → KILLED

9.9
Location : matches
Killed by : none
replaced boolean return with true for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → NO_COVERAGE

10.10
Location : matches
Killed by : none
replaced boolean return with true for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::matches → SURVIVED

32

1.1
Location : describeTo
Killed by : none
removed call to org/hamcrest/Matcher::describeTo → NO_COVERAGE

2.2
Location : describeTo
Killed by : oghamtesting.it.assertion.AssertionHelperSpec
removed call to org/hamcrest/Matcher::describeTo → KILLED

36

1.1
Location : getReason
Killed by : none
replaced return value with "" for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::getReason → NO_COVERAGE

2.2
Location : getReason
Killed by : oghamtesting.it.assertion.AssertionHelperSpec
replaced return value with "" for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::getReason → KILLED

40

1.1
Location : getDecoree
Killed by : oghamtesting.it.assertion.AssertionHelperSpec
replaced return value with null for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::getDecoree → KILLED

2.2
Location : getDecoree
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::getDecoree → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT OGHAM