| 1 | package fr.sii.ogham.testing.assertion.sms; | |
| 2 | ||
| 3 | import java.util.ArrayList; | |
| 4 | import java.util.Arrays; | |
| 5 | import java.util.List; | |
| 6 | ||
| 7 | /** | |
| 8 | * Represents a SMS that has been split into several parts in order to be sent. | |
| 9 | * | |
| 10 | * @author Aurélien Baudet | |
| 11 | * | |
| 12 | */ | |
| 13 | public class SplitSms { | |
| 14 | /** | |
| 15 | * Parts of the message when the message is too long and has to be split | |
| 16 | */ | |
| 17 | private final List<ExpectedSms> parts; | |
| 18 | ||
| 19 | /** | |
| 20 | * Initialize with the provided parts. Each part MUST contain: | |
| 21 | * <ul> | |
| 22 | * <li>The expected phone number of the sender</li> | |
| 23 | * <li>The expected phone number of the receiver</li> | |
| 24 | * <li>The expected message part</li> | |
| 25 | * </ul> | |
| 26 | * <p> | |
| 27 | * The receiver and sender numbers have to be duplicated. See | |
| 28 | * {@link #SplitSms(ExpectedAddressedPhoneNumber, ExpectedAddressedPhoneNumber, String...)} | |
| 29 | * for reusing the receiver and sender numbers. | |
| 30 | * </p> | |
| 31 | * | |
| 32 | * @param parts | |
| 33 | * the parts | |
| 34 | */ | |
| 35 | public SplitSms(List<ExpectedSms> parts) { | |
| 36 | super(); | |
| 37 | this.parts = parts; | |
| 38 | } | |
| 39 | ||
| 40 | /** | |
| 41 | * Initialize with the provided parts. Each part MUST contain: | |
| 42 | * <ul> | |
| 43 | * <li>The expected phone number of the sender</li> | |
| 44 | * <li>The expected phone number of the receiver</li> | |
| 45 | * <li>The expected message part</li> | |
| 46 | * </ul> | |
| 47 | * <p> | |
| 48 | * The receiver and sender numbers have to be duplicated. See | |
| 49 | * {@link #SplitSms(ExpectedAddressedPhoneNumber, ExpectedAddressedPhoneNumber, String...)} | |
| 50 | * for reusing the receiver and sender numbers. | |
| 51 | * </p> | |
| 52 | * | |
| 53 | * @param parts | |
| 54 | * the parts | |
| 55 | */ | |
| 56 | public SplitSms(ExpectedSms... parts) { | |
| 57 | this(Arrays.asList(parts)); | |
| 58 | } | |
| 59 | ||
| 60 | /** | |
| 61 | * Initialize several parts by reusing the sender and receiver numbers. Each | |
| 62 | * message part is directly provided as string. | |
| 63 | * | |
| 64 | * @param senderNumber | |
| 65 | * the number of the sender to use in each part | |
| 66 | * @param receiverNumber | |
| 67 | * the number of the receiver to use in each part | |
| 68 | * @param messages | |
| 69 | * the array of message parts | |
| 70 | */ | |
| 71 | public SplitSms(ExpectedAddressedPhoneNumber senderNumber, ExpectedAddressedPhoneNumber receiverNumber, String... messages) { | |
| 72 | this(toExpectedSms(senderNumber, receiverNumber, messages)); | |
| 73 | } | |
| 74 | ||
| 75 | private static List<ExpectedSms> toExpectedSms(ExpectedAddressedPhoneNumber senderNumber, ExpectedAddressedPhoneNumber receiverNumber, String[] messages) { | |
| 76 | List<ExpectedSms> parts = new ArrayList<>(messages.length); | |
| 77 | for (String message : messages) { | |
| 78 | parts.add(new ExpectedSms(message, senderNumber, receiverNumber)); | |
| 79 | } | |
| 80 |
2
1. toExpectedSms : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/sms/SplitSms::toExpectedSms → NO_COVERAGE 2. toExpectedSms : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/sms/SplitSms::toExpectedSms → KILLED |
return parts; |
| 81 | } | |
| 82 | ||
| 83 | /** | |
| 84 | * Get the parts of the message. | |
| 85 | * | |
| 86 | * @return the parts of the message | |
| 87 | */ | |
| 88 | public List<ExpectedSms> getParts() { | |
| 89 |
2
1. getParts : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/sms/SplitSms::getParts → NO_COVERAGE 2. getParts : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/sms/SplitSms::getParts → KILLED |
return parts; |
| 90 | } | |
| 91 | } | |
Mutations | ||
| 80 |
1.1 2.2 |
|
| 89 |
1.1 2.2 |