PhoneNumbersBuilder.java

1
package fr.sii.ogham.sms.builder;
2
3
import fr.sii.ogham.core.builder.Builder;
4
import fr.sii.ogham.core.builder.context.BuildContext;
5
import fr.sii.ogham.core.builder.env.EnvironmentBuilder;
6
import fr.sii.ogham.core.fluent.AbstractParent;
7
import fr.sii.ogham.sms.message.PhoneNumber;
8
import fr.sii.ogham.sms.message.addressing.AddressedPhoneNumber;
9
10
/**
11
 * Configures the phone number conversions (from a {@link PhoneNumber} to an
12
 * {@link AddressedPhoneNumber}).
13
 * 
14
 * The {@link PhoneNumber} is used by the developer to provide a simple phone
15
 * number without knowing how phone number works (no need to handle formats,
16
 * addressing, countries...). The {@link AddressedPhoneNumber} is used by Ogham
17
 * implementations to have a phone number that is usable by a technical system.
18
 * 
19
 * @author Aurélien Baudet
20
 *
21
 */
22
public class PhoneNumbersBuilder extends AbstractParent<SmsBuilder> implements Builder<PhoneNumberTranslatorPair> {
23
	private final BuildContext buildContext;
24
	private SenderNumberBuilder senderNumberBuilder;
25
	private RecipientNumberBuilder recipientNumberBuilder;
26
27
	/**
28
	 * Initializes the builder with a parent builder. The parent builder is used
29
	 * when calling {@link #and()} method. The {@link EnvironmentBuilder} is
30
	 * used to evaluate properties when {@link #build()} method is called.
31
	 * 
32
	 * @param parent
33
	 *            the parent builder
34
	 * @param buildContext
35
	 *            for registering instances and property evaluation
36
	 */
37
	public PhoneNumbersBuilder(SmsBuilder parent, BuildContext buildContext) {
38
		super(parent);
39
		this.buildContext = buildContext;
40
	}
41
42
	/**
43
	 * Configures the sender phone number conversion (from a {@link PhoneNumber}
44
	 * to an {@link AddressedPhoneNumber}).
45
	 * 
46
	 * The {@link PhoneNumber} is used by the developer to provide a simple
47
	 * phone number without knowing how phone number works (no need to handle
48
	 * formats, addressing, countries...). The {@link AddressedPhoneNumber} is
49
	 * used by Ogham implementations to have a phone number that is usable by a
50
	 * technical system.
51
	 * 
52
	 * @return the builder to configure the sender phone number
53
	 */
54
	public SenderNumberBuilder from() {
55 8 1. from : negated conditional → NO_COVERAGE
2. from : negated conditional → KILLED
3. from : negated conditional → KILLED
4. from : negated conditional → KILLED
5. from : negated conditional → KILLED
6. from : negated conditional → KILLED
7. from : negated conditional → KILLED
8. from : negated conditional → KILLED
		if (senderNumberBuilder == null) {
56
			senderNumberBuilder = new SenderNumberBuilder(this, buildContext);
57
		}
58 8 1. from : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::from → NO_COVERAGE
2. from : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::from → KILLED
3. from : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::from → KILLED
4. from : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::from → KILLED
5. from : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::from → KILLED
6. from : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::from → KILLED
7. from : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::from → KILLED
8. from : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::from → KILLED
		return senderNumberBuilder;
59
	}
60
61
	/**
62
	 * Configures the recipient phone number conversion (from a
63
	 * {@link PhoneNumber} to an {@link AddressedPhoneNumber}).
64
	 * 
65
	 * The {@link PhoneNumber} is used by the developer to provide a simple
66
	 * phone number without knowing how phone number works (no need to handle
67
	 * formats, addressing, countries...). The {@link AddressedPhoneNumber} is
68
	 * used by Ogham implementations to have a phone number that is usable by a
69
	 * technical system.
70
	 * 
71
	 * @return the builder to configure the recipient phone number
72
	 */
73
	public RecipientNumberBuilder to() {
74 8 1. to : negated conditional → NO_COVERAGE
2. to : negated conditional → KILLED
3. to : negated conditional → KILLED
4. to : negated conditional → KILLED
5. to : negated conditional → KILLED
6. to : negated conditional → KILLED
7. to : negated conditional → KILLED
8. to : negated conditional → KILLED
		if (recipientNumberBuilder == null) {
75
			recipientNumberBuilder = new RecipientNumberBuilder(this, buildContext);
76
		}
77 8 1. to : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::to → NO_COVERAGE
2. to : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::to → KILLED
3. to : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::to → KILLED
4. to : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::to → KILLED
5. to : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::to → KILLED
6. to : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::to → KILLED
7. to : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::to → KILLED
8. to : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::to → KILLED
		return recipientNumberBuilder;
78
	}
79
80
	@Override
81
	public PhoneNumberTranslatorPair build() {
82 8 1. build : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::build → NO_COVERAGE
2. build : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::build → KILLED
3. build : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::build → KILLED
4. build : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::build → KILLED
5. build : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::build → KILLED
6. build : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::build → KILLED
7. build : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::build → KILLED
8. build : replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::build → KILLED
		return buildContext.register(new PhoneNumberTranslatorPair(senderNumberBuilder.build(), recipientNumberBuilder.build()));
83
	}
84
}

Mutations

55

1.1
Location : from
Killed by : oghamcore.it.core.service.CleanupTest.manualCleanupShouldAutomaticallyCleanTheSenders(oghamcore.it.core.service.CleanupTest)
negated conditional → KILLED

2.2
Location : from
Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec
negated conditional → KILLED

3.3
Location : from
Killed by : none
negated conditional → NO_COVERAGE

4.4
Location : from
Killed by : oghamjavamail.it.UnreadableAttachmentTest.attachmentUnreadable(oghamjavamail.it.UnreadableAttachmentTest)
negated conditional → KILLED

5.5
Location : from
Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest)
negated conditional → KILLED

6.6
Location : from
Killed by : oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests.oghamPropertiesWithSpringPropsShouldUseOghamPropertiesPrecedence(oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests)
negated conditional → KILLED

7.7
Location : from
Killed by : oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests.oghamAloneShouldUseOghamProperties(oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests)
negated conditional → KILLED

8.8
Location : from
Killed by : oghamall.it.html.translator.JsoupInlineCssTranslatorTest.notHtml(oghamall.it.html.translator.JsoupInlineCssTranslatorTest)
negated conditional → KILLED

58

1.1
Location : from
Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::from → KILLED

2.2
Location : from
Killed by : oghamcore.it.core.service.CleanupTest.manualCleanupShouldAutomaticallyCleanTheSenders(oghamcore.it.core.service.CleanupTest)
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::from → KILLED

3.3
Location : from
Killed by : oghamall.it.html.translator.JsoupInlineCssTranslatorTest.notHtml(oghamall.it.html.translator.JsoupInlineCssTranslatorTest)
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::from → KILLED

4.4
Location : from
Killed by : oghamjavamail.it.UnreadableAttachmentTest.attachmentUnreadable(oghamjavamail.it.UnreadableAttachmentTest)
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::from → KILLED

5.5
Location : from
Killed by : oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests.oghamPropertiesWithSpringPropsShouldUseOghamPropertiesPrecedence(oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests)
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::from → KILLED

6.6
Location : from
Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest)
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::from → KILLED

7.7
Location : from
Killed by : oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests.oghamAloneShouldUseOghamProperties(oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests)
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::from → KILLED

8.8
Location : from
Killed by : none
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::from → NO_COVERAGE

74

1.1
Location : to
Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest)
negated conditional → KILLED

2.2
Location : to
Killed by : oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests.oghamAloneShouldUseOghamProperties(oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests)
negated conditional → KILLED

3.3
Location : to
Killed by : oghamall.it.html.translator.JsoupInlineCssTranslatorTest.notHtml(oghamall.it.html.translator.JsoupInlineCssTranslatorTest)
negated conditional → KILLED

4.4
Location : to
Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec
negated conditional → KILLED

5.5
Location : to
Killed by : oghamjavamail.it.UnreadableAttachmentTest.attachmentUnreadable(oghamjavamail.it.UnreadableAttachmentTest)
negated conditional → KILLED

6.6
Location : to
Killed by : oghamcore.it.core.service.CleanupTest.manualCleanupShouldAutomaticallyCleanTheSenders(oghamcore.it.core.service.CleanupTest)
negated conditional → KILLED

7.7
Location : to
Killed by : none
negated conditional → NO_COVERAGE

8.8
Location : to
Killed by : oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests.oghamPropertiesWithSpringPropsShouldUseOghamPropertiesPrecedence(oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests)
negated conditional → KILLED

77

1.1
Location : to
Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest)
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::to → KILLED

2.2
Location : to
Killed by : oghamall.it.html.translator.JsoupInlineCssTranslatorTest.notHtml(oghamall.it.html.translator.JsoupInlineCssTranslatorTest)
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::to → KILLED

3.3
Location : to
Killed by : oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests.oghamAloneShouldUseOghamProperties(oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests)
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::to → KILLED

4.4
Location : to
Killed by : none
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::to → NO_COVERAGE

5.5
Location : to
Killed by : oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests.oghamPropertiesWithSpringPropsShouldUseOghamPropertiesPrecedence(oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests)
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::to → KILLED

6.6
Location : to
Killed by : oghamcore.it.core.service.CleanupTest.manualCleanupShouldAutomaticallyCleanTheSenders(oghamcore.it.core.service.CleanupTest)
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::to → KILLED

7.7
Location : to
Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::to → KILLED

8.8
Location : to
Killed by : oghamjavamail.it.UnreadableAttachmentTest.attachmentUnreadable(oghamjavamail.it.UnreadableAttachmentTest)
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::to → KILLED

82

1.1
Location : build
Killed by : oghamcore.it.core.service.CleanupTest.manualCleanupShouldAutomaticallyCleanTheSenders(oghamcore.it.core.service.CleanupTest)
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::build → KILLED

2.2
Location : build
Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::build → KILLED

3.3
Location : build
Killed by : none
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::build → NO_COVERAGE

4.4
Location : build
Killed by : oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests.oghamAloneShouldUseOghamProperties(oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests)
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::build → KILLED

5.5
Location : build
Killed by : oghamall.it.optional.ImplementationSelectionTests.javaMailAvailable(oghamall.it.optional.ImplementationSelectionTests)
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::build → KILLED

6.6
Location : build
Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest)
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::build → KILLED

7.7
Location : build
Killed by : oghamjavamail.it.UnreadableAttachmentTest.attachmentUnreadable(oghamjavamail.it.UnreadableAttachmentTest)
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::build → KILLED

8.8
Location : build
Killed by : oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests.oghamPropertiesWithSpringPropsShouldUseOghamPropertiesPrecedence(oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests)
replaced return value with null for fr/sii/ogham/sms/builder/PhoneNumbersBuilder::build → KILLED

Active mutators

Tests examined


Report generated by PIT OGHAM