| 1 | package fr.sii.ogham.testing.assertion.sms; | |
| 2 | ||
| 3 | import static java.util.regex.Matcher.quoteReplacement; | |
| 4 | import static java.util.regex.Pattern.quote; | |
| 5 | ||
| 6 | import fr.sii.ogham.testing.assertion.context.Context; | |
| 7 | ||
| 8 | /** | |
| 9 | * Context dedicated to a phone number of a particular message. | |
| 10 | * | |
| 11 | * @author Aurélien Baudet | |
| 12 | * | |
| 13 | */ | |
| 14 | public class PhoneNumberWithContext implements Context { | |
| 15 | private final PhoneNumberInfo number; | |
| 16 | private final String name; | |
| 17 | private final Context parent; | |
| 18 | ||
| 19 | /** | |
| 20 | * @param number | |
| 21 | * the phone number | |
| 22 | * @param name | |
| 23 | * a name to identify it in the context (sender or receiver) | |
| 24 | * @param parent | |
| 25 | * the parent context | |
| 26 | */ | |
| 27 | public PhoneNumberWithContext(PhoneNumberInfo number, String name, Context parent) { | |
| 28 | super(); | |
| 29 | this.number = number; | |
| 30 | this.name = name; | |
| 31 | this.parent = parent; | |
| 32 | } | |
| 33 | ||
| 34 | @Override | |
| 35 | public String evaluate(String template) { | |
| 36 | String result = template.replaceAll(quote("${numberName}"), quoteReplacement(name)); | |
| 37 |
3
1. evaluate : replaced return value with "" for fr/sii/ogham/testing/assertion/sms/PhoneNumberWithContext::evaluate → NO_COVERAGE 2. evaluate : replaced return value with "" for fr/sii/ogham/testing/assertion/sms/PhoneNumberWithContext::evaluate → SURVIVED 3. evaluate : replaced return value with "" for fr/sii/ogham/testing/assertion/sms/PhoneNumberWithContext::evaluate → KILLED |
return parent.evaluate(result); |
| 38 | } | |
| 39 | ||
| 40 | /** | |
| 41 | * @return the phone number | |
| 42 | */ | |
| 43 | public PhoneNumberInfo getNumber() { | |
| 44 |
4
1. getNumber : replaced return value with null for fr/sii/ogham/testing/assertion/sms/PhoneNumberWithContext::getNumber → NO_COVERAGE 2. getNumber : replaced return value with null for fr/sii/ogham/testing/assertion/sms/PhoneNumberWithContext::getNumber → KILLED 3. getNumber : replaced return value with null for fr/sii/ogham/testing/assertion/sms/PhoneNumberWithContext::getNumber → KILLED 4. getNumber : replaced return value with null for fr/sii/ogham/testing/assertion/sms/PhoneNumberWithContext::getNumber → KILLED |
return number; |
| 45 | } | |
| 46 | } | |
Mutations | ||
| 37 |
1.1 2.2 3.3 |
|
| 44 |
1.1 2.2 3.3 4.4 |