1 | package fr.sii.ogham.sms.message.addressing; | |
2 | ||
3 | import fr.sii.ogham.core.util.EqualsBuilder; | |
4 | import fr.sii.ogham.core.util.HashCodeBuilder; | |
5 | import fr.sii.ogham.sms.message.PhoneNumber; | |
6 | ||
7 | /** | |
8 | * A phone number plus its addressing information (as described in GSM 03.40). | |
9 | * <ul> | |
10 | * <li>The type of number (TON)</li> | |
11 | * <li>The numbering plan identification (NPI)</li> | |
12 | * </ul> | |
13 | * | |
14 | * @author cdejonghe | |
15 | * | |
16 | */ | |
17 | public class AddressedPhoneNumber extends PhoneNumber { | |
18 | /** The type of number (TON); */ | |
19 | private final TypeOfNumber ton; | |
20 | ||
21 | /** <li>The numbering plan identification (NPI). */ | |
22 | private final NumberingPlanIndicator npi; | |
23 | ||
24 | /** | |
25 | * Initializes the phone number with the given number, TON and NPI. | |
26 | * | |
27 | * @param number | |
28 | * Phone number in text format | |
29 | * @param ton | |
30 | * Type of number | |
31 | * @param npi | |
32 | * Numbering plan identification | |
33 | */ | |
34 | public AddressedPhoneNumber(String number, TypeOfNumber ton, NumberingPlanIndicator npi) { | |
35 | super(number); | |
36 | this.ton = ton; | |
37 | this.npi = npi; | |
38 | } | |
39 | ||
40 | public TypeOfNumber getTon() { | |
41 |
4
1. getTon : replaced return value with null for fr/sii/ogham/sms/message/addressing/AddressedPhoneNumber::getTon → NO_COVERAGE 2. getTon : replaced return value with null for fr/sii/ogham/sms/message/addressing/AddressedPhoneNumber::getTon → TIMED_OUT 3. getTon : replaced return value with null for fr/sii/ogham/sms/message/addressing/AddressedPhoneNumber::getTon → KILLED 4. getTon : replaced return value with null for fr/sii/ogham/sms/message/addressing/AddressedPhoneNumber::getTon → KILLED |
return ton; |
42 | } | |
43 | ||
44 | public NumberingPlanIndicator getNpi() { | |
45 |
4
1. getNpi : replaced return value with null for fr/sii/ogham/sms/message/addressing/AddressedPhoneNumber::getNpi → NO_COVERAGE 2. getNpi : replaced return value with null for fr/sii/ogham/sms/message/addressing/AddressedPhoneNumber::getNpi → TIMED_OUT 3. getNpi : replaced return value with null for fr/sii/ogham/sms/message/addressing/AddressedPhoneNumber::getNpi → KILLED 4. getNpi : replaced return value with null for fr/sii/ogham/sms/message/addressing/AddressedPhoneNumber::getNpi → KILLED |
return npi; |
46 | } | |
47 | ||
48 | @Override | |
49 | public String toString() { | |
50 | StringBuilder builder = new StringBuilder(); | |
51 |
6
1. toString : negated conditional → NO_COVERAGE 2. toString : negated conditional → SURVIVED 3. toString : negated conditional → SURVIVED 4. toString : negated conditional → NO_COVERAGE 5. toString : negated conditional → TIMED_OUT 6. toString : negated conditional → TIMED_OUT |
if (getNumber() != null && !getNumber().isEmpty()) { |
52 | builder.append(getNumber()).append("|TON:").append(ton).append("|NPI:").append(npi); | |
53 | } | |
54 |
3
1. toString : replaced return value with "" for fr/sii/ogham/sms/message/addressing/AddressedPhoneNumber::toString → SURVIVED 2. toString : replaced return value with "" for fr/sii/ogham/sms/message/addressing/AddressedPhoneNumber::toString → NO_COVERAGE 3. toString : replaced return value with "" for fr/sii/ogham/sms/message/addressing/AddressedPhoneNumber::toString → TIMED_OUT |
return builder.toString(); |
55 | } | |
56 | ||
57 | @Override | |
58 | public int hashCode() { | |
59 |
1
1. hashCode : replaced int return with 0 for fr/sii/ogham/sms/message/addressing/AddressedPhoneNumber::hashCode → NO_COVERAGE |
return new HashCodeBuilder().append(getNumber(), ton, npi).hashCode(); |
60 | } | |
61 | ||
62 | @Override | |
63 | public boolean equals(Object obj) { | |
64 |
4
1. equals : replaced boolean return with false for fr/sii/ogham/sms/message/addressing/AddressedPhoneNumber::equals → NO_COVERAGE 2. equals : replaced boolean return with true for fr/sii/ogham/sms/message/addressing/AddressedPhoneNumber::equals → NO_COVERAGE 3. equals : replaced boolean return with true for fr/sii/ogham/sms/message/addressing/AddressedPhoneNumber::equals → SURVIVED 4. equals : replaced boolean return with false for fr/sii/ogham/sms/message/addressing/AddressedPhoneNumber::equals → KILLED |
return new EqualsBuilder(this, obj).appendFields("number", "ton", "npi").isEqual(); |
65 | } | |
66 | ||
67 | } | |
Mutations | ||
41 |
1.1 2.2 3.3 4.4 |
|
45 |
1.1 2.2 3.3 4.4 |
|
51 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
54 |
1.1 2.2 3.3 |
|
59 |
1.1 |
|
64 |
1.1 2.2 3.3 4.4 |