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 2 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
		return matcher.matches(item);
28
	}
29
30
	@Override
31
	public void describeTo(Description description) {
32 1 1. describeTo : removed call to org/hamcrest/Matcher::describeTo → NO_COVERAGE
		matcher.describeTo(description);
33
	}
34
35
	public String getReason() {
36 1 1. getReason : replaced return value with "" for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::getReason → NO_COVERAGE
		return reason;
37
	}
38
39
	public Matcher<T> getDecoree() {
40 1 1. getDecoree : replaced return value with null for fr/sii/ogham/testing/assertion/hamcrest/CustomReason::getDecoree → NO_COVERAGE
		return matcher;
41
	}
42
43
}

Mutations

27

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

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

32

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

36

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

40

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

Active mutators

Tests examined


Report generated by PIT 1.13.1