| 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 | * Override description generated by Hamcrest with a fixed string. | |
| 9 | * | |
| 10 | * @param <T> | |
| 11 | * the type of the actual value | |
| 12 | * | |
| 13 | * | |
| 14 | * @author Aurélien Baudet | |
| 15 | * | |
| 16 | */ | |
| 17 | public class OverrideDescription<T> extends BaseMatcher<T> implements DecoratorMatcher<T>, CustomDescriptionProvider<T> { | |
| 18 | private final String description; | |
| 19 | private final Matcher<T> matcher; | |
| 20 | ||
| 21 | public OverrideDescription(String description, Matcher<T> matcher) { | |
| 22 | super(); | |
| 23 | this.description = description; | |
| 24 | this.matcher = matcher; | |
| 25 | } | |
| 26 | ||
| 27 | @Override | |
| 28 | public boolean matches(Object actual) { | |
| 29 |
10
1. matches : replaced boolean return with false for fr/sii/ogham/testing/assertion/hamcrest/OverrideDescription::matches → NO_COVERAGE 2. matches : replaced boolean return with true for fr/sii/ogham/testing/assertion/hamcrest/OverrideDescription::matches → NO_COVERAGE 3. matches : replaced boolean return with true for fr/sii/ogham/testing/assertion/hamcrest/OverrideDescription::matches → SURVIVED 4. matches : replaced boolean return with false for fr/sii/ogham/testing/assertion/hamcrest/OverrideDescription::matches → TIMED_OUT 5. matches : replaced boolean return with true for fr/sii/ogham/testing/assertion/hamcrest/OverrideDescription::matches → TIMED_OUT 6. matches : replaced boolean return with false for fr/sii/ogham/testing/assertion/hamcrest/OverrideDescription::matches → KILLED 7. matches : replaced boolean return with false for fr/sii/ogham/testing/assertion/hamcrest/OverrideDescription::matches → KILLED 8. matches : replaced boolean return with false for fr/sii/ogham/testing/assertion/hamcrest/OverrideDescription::matches → KILLED 9. matches : replaced boolean return with false for fr/sii/ogham/testing/assertion/hamcrest/OverrideDescription::matches → KILLED 10. matches : replaced boolean return with true for fr/sii/ogham/testing/assertion/hamcrest/OverrideDescription::matches → KILLED |
return matcher.matches(actual); |
| 30 | } | |
| 31 | ||
| 32 | @Override | |
| 33 | public void describeTo(Description description) { | |
| 34 |
1
1. describeTo : removed call to org/hamcrest/Matcher::describeTo → NO_COVERAGE |
matcher.describeTo(description); |
| 35 | } | |
| 36 | ||
| 37 | @Override | |
| 38 | public Description describe(String reason, T actual, String additionalText) { | |
| 39 |
2
1. describe : replaced return value with null for fr/sii/ogham/testing/assertion/hamcrest/OverrideDescription::describe → NO_COVERAGE 2. describe : replaced return value with null for fr/sii/ogham/testing/assertion/hamcrest/OverrideDescription::describe → KILLED |
return new FixedDescription(description); |
| 40 | } | |
| 41 | ||
| 42 | @Override | |
| 43 | public Matcher<T> getDecoree() { | |
| 44 |
2
1. getDecoree : replaced return value with null for fr/sii/ogham/testing/assertion/hamcrest/OverrideDescription::getDecoree → SURVIVED 2. getDecoree : replaced return value with null for fr/sii/ogham/testing/assertion/hamcrest/OverrideDescription::getDecoree → NO_COVERAGE |
return matcher; |
| 45 | } | |
| 46 | ||
| 47 | } | |
Mutations | ||
| 29 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 9.9 10.10 |
|
| 34 |
1.1 |
|
| 39 |
1.1 2.2 |
|
| 44 |
1.1 2.2 |