| 1 | package fr.sii.ogham.sms.message.addressing.translator; | |
| 2 | ||
| 3 | import java.util.regex.Pattern; | |
| 4 | ||
| 5 | import fr.sii.ogham.sms.message.PhoneNumber; | |
| 6 | import fr.sii.ogham.sms.message.addressing.NumberingPlanIndicator; | |
| 7 | import fr.sii.ogham.sms.message.addressing.TypeOfNumber; | |
| 8 | ||
| 9 | /** | |
| 10 | * | |
| 11 | * If the sender address is alphanumeric (contains both letters and numbers) or | |
| 12 | * non-numeric, TON is set to 5 and NPI to 0. | |
| 13 | * | |
| 14 | * @author cdejonghe | |
| 15 | * | |
| 16 | */ | |
| 17 | public class AlphanumericCodeNumberFormatHandler extends AbstractFixedPhoneNumberHandler { | |
| 18 | ||
| 19 | private static final Pattern NUMERIC_ONLY_PATTERN = Pattern.compile("(\\+)?[0-9]+"); | |
| 20 | ||
| 21 | public AlphanumericCodeNumberFormatHandler() { | |
| 22 | super(TypeOfNumber.ALPHANUMERIC, NumberingPlanIndicator.UNKNOWN); | |
| 23 | } | |
| 24 | ||
| 25 | @Override | |
| 26 | public boolean supports(PhoneNumber phoneNumber) { | |
| 27 |
4
1. supports : negated conditional → NO_COVERAGE 2. supports : replaced boolean return with true for fr/sii/ogham/sms/message/addressing/translator/AlphanumericCodeNumberFormatHandler::supports → NO_COVERAGE 3. supports : negated conditional → NO_COVERAGE 4. supports : negated conditional → NO_COVERAGE |
return phoneNumber != null && phoneNumber.getNumber() != null && !NUMERIC_ONLY_PATTERN.matcher(phoneNumber.getNumber()).matches(); |
| 28 | } | |
| 29 | } | |
Mutations | ||
| 27 |
1.1 2.2 3.3 4.4 |