AbstractJUnitSmppServerExt.java

1
package fr.sii.ogham.testing.extension.junit.sms;
2
3
import static java.util.stream.Collectors.toList;
4
5
import java.util.Collections;
6
import java.util.List;
7
8
import org.junit.Rule;
9
import org.junit.jupiter.api.extension.Extension;
10
11
import fr.sii.ogham.testing.extension.junit.sms.config.ServerConfig;
12
import fr.sii.ogham.testing.sms.simulator.SmppServerSimulator;
13
import fr.sii.ogham.testing.sms.simulator.bean.SubmitSm;
14
import fr.sii.ogham.testing.sms.simulator.config.SimulatorConfiguration;
15
16
/**
17
 * Base class for JUnit {@link Rule} and JUnit {@link Extension}.
18
 * 
19
 * @author Aurélien Baudet
20
 *
21
 * @param <M>
22
 *            The type of the received messages
23
 */
24
public abstract class AbstractJUnitSmppServerExt<M> {
25
26
	/**
27
	 * The configuration to control how server should behave
28
	 */
29
	protected final ServerConfig builder;
30
	/**
31
	 * The server simulator
32
	 */
33
	protected SmppServerSimulator<M> server;
34
35
	/**
36
	 * Initializes with the default configuration to use for the SMPP server
37
	 * 
38
	 */
39
	public AbstractJUnitSmppServerExt() {
40
		this(new ServerConfig());
41
	}
42
43
	/**
44
	 * Initializes with the configuration to use for the SMPP server
45
	 * 
46
	 * @param builder
47
	 *            the configuration for the server
48
	 */
49
	public AbstractJUnitSmppServerExt(ServerConfig builder) {
50
		super();
51
		this.builder = builder;
52
	}
53
54
	/**
55
	 * Get the port used by the server.
56
	 * 
57
	 * @return the port used by the server
58
	 */
59
	public int getPort() {
60 5 1. getPort : replaced int return with 0 for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getPort → SURVIVED
2. getPort : replaced int return with 0 for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getPort → NO_COVERAGE
3. getPort : replaced int return with 0 for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getPort → TIMED_OUT
4. getPort : replaced int return with 0 for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getPort → KILLED
5. getPort : replaced int return with 0 for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getPort → KILLED
		return server.getPort();
61
	}
62
63
	/**
64
	 * Provide the list of received messages during the execution of the test.
65
	 * 
66
	 * @return the list of received messages
67
	 */
68
	public List<M> getRawMessages() {
69 4 1. getRawMessages : negated conditional → NO_COVERAGE
2. getRawMessages : negated conditional → TIMED_OUT
3. getRawMessages : negated conditional → KILLED
4. getRawMessages : negated conditional → KILLED
		if (server == null) {
70
			return Collections.emptyList();
71
		}
72 4 1. getRawMessages : replaced return value with Collections.emptyList for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getRawMessages → NO_COVERAGE
2. getRawMessages : replaced return value with Collections.emptyList for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getRawMessages → TIMED_OUT
3. getRawMessages : replaced return value with Collections.emptyList for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getRawMessages → KILLED
4. getRawMessages : replaced return value with Collections.emptyList for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getRawMessages → KILLED
		return server.getReceivedMessages();
73
	}
74
75
	/**
76
	 * Provide the list of received messages during the execution of the test.
77
	 * 
78
	 * The raw messages are converted to the common interface
79
	 * ({@link SubmitSm}).
80
	 * 
81
	 * @return the list of received messages
82
	 */
83
	public List<SubmitSm> getReceivedMessages() {
84 4 1. getReceivedMessages : replaced return value with Collections.emptyList for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getReceivedMessages → NO_COVERAGE
2. getReceivedMessages : replaced return value with Collections.emptyList for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getReceivedMessages → TIMED_OUT
3. getReceivedMessages : replaced return value with Collections.emptyList for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getReceivedMessages → KILLED
4. getReceivedMessages : replaced return value with Collections.emptyList for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getReceivedMessages → KILLED
		return getRawMessages().stream().map(this::convert).collect(toList());
85
	}
86
87
	/**
88
	 * Initialize the server with the ready to use configuration.
89
	 * 
90
	 * @param simulatorConfiguration
91
	 *            the configuration to apply to the server
92
	 * @return the server instance
93
	 */
94
	protected abstract SmppServerSimulator<M> initServer(SimulatorConfiguration simulatorConfiguration);
95
96
	protected abstract SubmitSm convert(M raw);
97
98
}

Mutations

60

1.1
Location : getPort
Killed by : none
replaced int return with 0 for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getPort → SURVIVED

2.2
Location : getPort
Killed by : none
replaced int return with 0 for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getPort → NO_COVERAGE

3.3
Location : getPort
Killed by : none
replaced int return with 0 for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getPort → TIMED_OUT

4.4
Location : getPort
Killed by : oghamall.it.freemarker.StaticMethodAccessDisabledTest.smsUsingFreemarkerTemplateAndStaticMethodAccessDisabledShouldFail(oghamall.it.freemarker.StaticMethodAccessDisabledTest)
replaced int return with 0 for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getPort → KILLED

5.5
Location : getPort
Killed by : oghamcloudhopper.it.PartialConfigurationTest.splitterEnabledButAutoGuessNotEnabledAndNoEncodingConfiguredAndLongMessageShouldFailIndicatingThatNoSplitterIsConfigured(oghamcloudhopper.it.PartialConfigurationTest)
replaced int return with 0 for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getPort → KILLED

69

1.1
Location : getRawMessages
Killed by : oghamall.it.sms.SmsSMPPGsm7bitTest.longMessage(oghamall.it.sms.SmsSMPPGsm7bitTest)
negated conditional → KILLED

2.2
Location : getRawMessages
Killed by : oghamcloudhopper.it.PartialConfigurationTest.nothingConfiguredAndLongMessageShouldSendOneLongMessageUsingDefaultEncoding(oghamcloudhopper.it.PartialConfigurationTest)
negated conditional → KILLED

3.3
Location : getRawMessages
Killed by : none
negated conditional → TIMED_OUT

4.4
Location : getRawMessages
Killed by : none
negated conditional → NO_COVERAGE

72

1.1
Location : getRawMessages
Killed by : oghamcloudhopper.it.PartialConfigurationTest.nothingConfiguredAndLongMessageShouldSendOneLongMessageUsingDefaultEncoding(oghamcloudhopper.it.PartialConfigurationTest)
replaced return value with Collections.emptyList for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getRawMessages → KILLED

2.2
Location : getRawMessages
Killed by : none
replaced return value with Collections.emptyList for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getRawMessages → NO_COVERAGE

3.3
Location : getRawMessages
Killed by : oghamall.it.sms.SmsSMPPGsm7bitTest.longMessage(oghamall.it.sms.SmsSMPPGsm7bitTest)
replaced return value with Collections.emptyList for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getRawMessages → KILLED

4.4
Location : getRawMessages
Killed by : none
replaced return value with Collections.emptyList for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getRawMessages → TIMED_OUT

84

1.1
Location : getReceivedMessages
Killed by : oghamall.it.sms.SmsSMPPGsm7bitTest.longMessage(oghamall.it.sms.SmsSMPPGsm7bitTest)
replaced return value with Collections.emptyList for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getReceivedMessages → KILLED

2.2
Location : getReceivedMessages
Killed by : none
replaced return value with Collections.emptyList for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getReceivedMessages → NO_COVERAGE

3.3
Location : getReceivedMessages
Killed by : oghamcloudhopper.it.PartialConfigurationTest.nothingConfiguredAndLongMessageShouldSendOneLongMessageUsingDefaultEncoding(oghamcloudhopper.it.PartialConfigurationTest)
replaced return value with Collections.emptyList for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getReceivedMessages → KILLED

4.4
Location : getReceivedMessages
Killed by : none
replaced return value with Collections.emptyList for fr/sii/ogham/testing/extension/junit/sms/AbstractJUnitSmppServerExt::getReceivedMessages → TIMED_OUT

Active mutators

Tests examined


Report generated by PIT OGHAM