FluentSmsListAssert.java

1
package fr.sii.ogham.testing.assertion.sms;
2
3
import static fr.sii.ogham.testing.assertion.util.AssertionHelper.assertThat;
4
import static fr.sii.ogham.testing.assertion.util.AssertionHelper.overrideDescription;
5
import static org.hamcrest.Matchers.lessThan;
6
7
import java.util.List;
8
9
import org.hamcrest.Matcher;
10
11
import fr.sii.ogham.testing.assertion.util.AssertionRegistry;
12
import fr.sii.ogham.testing.sms.simulator.bean.SubmitSm;
13
import fr.sii.ogham.testing.util.HasParent;
14
15
/**
16
 * Make assertions on received messages
17
 * 
18
 * @author Aurélien Baudet
19
 *
20
 * @param <P>
21
 *            the parent type
22
 * @param <S>
23
 *            the type of {@link SubmitSm}
24
 */
25
public class FluentSmsListAssert<P, S extends SubmitSm> extends HasParent<P> {
26
	/**
27
	 * The list of messages that will be used for assertions
28
	 */
29
	private final List<S> actual;
30
	private final AssertionRegistry registry;
31
32
	/**
33
	 * @param actual
34
	 *            the received messages
35
	 * @param parent
36
	 *            the parent
37
	 * @param registry
38
	 *            used to register assertions
39
	 */
40
	public FluentSmsListAssert(List<S> actual, P parent, AssertionRegistry registry) {
41
		super(parent);
42
		this.actual = actual;
43
		this.registry = registry;
44
	}
45
46
	/**
47
	 * Assertion on the number of received messages:
48
	 * 
49
	 * <pre>
50
	 * .count(is(1))
51
	 * </pre>
52
	 * 
53
	 * @param matcher
54
	 *            the assertion applied on the number of received messages
55
	 * @return the fluent API for chaining assertions on received messages
56
	 */
57
	public FluentSmsListAssert<P, S> count(Matcher<Integer> matcher) {
58 8 1. count : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → NO_COVERAGE
2. count : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → SURVIVED
3. lambda$count$0 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → NO_COVERAGE
4. lambda$count$0 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → SURVIVED
5. count : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → TIMED_OUT
6. lambda$count$0 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → TIMED_OUT
7. count : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → KILLED
8. lambda$count$0 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → KILLED
		registry.register(() -> assertThat("Received messages count", actual.size(), matcher));
59 5 1. count : replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::count → NO_COVERAGE
2. count : replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::count → SURVIVED
3. count : replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::count → TIMED_OUT
4. count : replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::count → KILLED
5. count : replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::count → KILLED
		return this;
60
	}
61
62
	/**
63
	 * Access a particular message to write assertions for it:
64
	 * 
65
	 * <pre>
66
	 * .message(0).content(is("foobar"))
67
	 * </pre>
68
	 * 
69
	 * You can use this method to chain several assertions on different
70
	 * messages:
71
	 * 
72
	 * <pre>
73
	 * .message(0).content(is("foobar"))
74
	 * .and()
75
	 * .message(1).content(is("toto"))
76
	 * </pre>
77
	 * 
78
	 * 
79
	 * @param index
80
	 *            the index of the message in the received list
81
	 * @return the fluent API for chaining assertions on received messages
82
	 */
83
	public FluentSmsAssert<FluentSmsListAssert<P, S>, S> message(int index) {
84 8 1. lambda$message$1 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → NO_COVERAGE
2. lambda$message$1 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → SURVIVED
3. message : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → SURVIVED
4. message : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → NO_COVERAGE
5. lambda$message$1 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → TIMED_OUT
6. message : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → TIMED_OUT
7. lambda$message$1 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → KILLED
8. message : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → KILLED
		registry.register(() -> assertThat(index, overrideDescription("Assertions on message "+index+" can't be executed because "+actual.size()+" messages were received", lessThan(actual.size()))));
85 14 1. message : changed conditional boundary → NO_COVERAGE
2. message : changed conditional boundary → SURVIVED
3. message : negated conditional → NO_COVERAGE
4. message : replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::message → NO_COVERAGE
5. message : changed conditional boundary → TIMED_OUT
6. message : negated conditional → TIMED_OUT
7. message : replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::message → TIMED_OUT
8. message : changed conditional boundary → KILLED
9. message : negated conditional → KILLED
10. message : negated conditional → KILLED
11. message : negated conditional → KILLED
12. message : replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::message → KILLED
13. message : replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::message → KILLED
14. message : replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::message → KILLED
		return new FluentSmsAssert<>(index<actual.size() ? actual.get(index) : null, index, this, registry);
86
	}
87
88
	/**
89
	 * Fluent API to write assertions on every received messages. Any defined
90
	 * assertion will be applied on every message:
91
	 * 
92
	 * <pre>
93
	 * .receivedMessages().every().content(is("foobar"))
94
	 * </pre>
95
	 * 
96
	 * Will check that content of every message is "foobar".
97
	 * 
98
	 * <p>
99
	 * You can use this method to factorize several assertions on a message and
100
	 * then make dedicated assertions on some messages:
101
	 * 
102
	 * <pre>
103
	 * .receivedMessages().every()
104
	 *                       .content(is("foobar"))
105
	 *                    .and()
106
	 *                    .message(0)
107
	 *                       .from().number(is("+33102030405"))
108
	 * </pre>
109
	 * 
110
	 * Will check that content of every message is "foobar" and that body of
111
	 * first received message is "+33102030405".
112
	 * 
113
	 * @return the fluent API for chaining assertions on received messages
114
	 */
115
	public FluentSmsAssert<FluentSmsListAssert<P, S>, S> every() {
116 4 1. every : replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::every → NO_COVERAGE
2. every : replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::every → KILLED
3. every : replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::every → KILLED
4. every : replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::every → KILLED
		return new FluentSmsAssert<>(actual, this, registry);
117
	}
118
}

Mutations

58

1.1
Location : count
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → NO_COVERAGE

2.2
Location : count
Killed by : oghamtesting.it.assertion.FluentSmsAssertionsSpec
removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → KILLED

3.3
Location : count
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → SURVIVED

4.4
Location : count
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → TIMED_OUT

5.5
Location : lambda$count$0
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → NO_COVERAGE

6.6
Location : lambda$count$0
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → TIMED_OUT

7.7
Location : lambda$count$0
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → SURVIVED

8.8
Location : lambda$count$0
Killed by : oghamtesting.it.assertion.FluentSmsAssertionsSpec
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → KILLED

59

1.1
Location : count
Killed by : oghamcloudhopper.it.PartialConfigurationTest.nothingConfiguredAndLongMessageShouldSendOneLongMessageUsingDefaultEncoding(oghamcloudhopper.it.PartialConfigurationTest)
replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::count → KILLED

2.2
Location : count
Killed by : oghamall.it.sms.SmsSMPPGsm7bitTest.longMessage(oghamall.it.sms.SmsSMPPGsm7bitTest)
replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::count → KILLED

3.3
Location : count
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::count → NO_COVERAGE

4.4
Location : count
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::count → SURVIVED

5.5
Location : count
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::count → TIMED_OUT

84

1.1
Location : lambda$message$1
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → TIMED_OUT

2.2
Location : lambda$message$1
Killed by : oghamtesting.it.assertion.FluentSmsAssertionsSpec
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → KILLED

3.3
Location : lambda$message$1
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → NO_COVERAGE

4.4
Location : lambda$message$1
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → SURVIVED

5.5
Location : message
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → SURVIVED

6.6
Location : message
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → NO_COVERAGE

7.7
Location : message
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → TIMED_OUT

8.8
Location : message
Killed by : oghamtesting.it.assertion.FluentSmsAssertionsSpec
removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → KILLED

85

1.1
Location : message
Killed by : none
changed conditional boundary → TIMED_OUT

2.2
Location : message
Killed by : none
changed conditional boundary → NO_COVERAGE

3.3
Location : message
Killed by : none
changed conditional boundary → SURVIVED

4.4
Location : message
Killed by : oghamtesting.it.assertion.FluentSmsAssertionsSpec
changed conditional boundary → KILLED

5.5
Location : message
Killed by : oghamtesting.it.assertion.FluentSmsAssertionsSpec
negated conditional → KILLED

6.6
Location : message
Killed by : none
negated conditional → TIMED_OUT

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

8.8
Location : message
Killed by : oghamcloudhopper.it.PartialConfigurationTest.nothingConfiguredAndLongMessageShouldSendOneLongMessageUsingDefaultEncoding(oghamcloudhopper.it.PartialConfigurationTest)
negated conditional → KILLED

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

10.10
Location : message
Killed by : oghamtesting.it.assertion.FluentSmsAssertionsSpec
replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::message → KILLED

11.11
Location : message
Killed by : oghamall.it.sms.SmsSMPPGsm7bitTest.longMessage(oghamall.it.sms.SmsSMPPGsm7bitTest)
replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::message → KILLED

12.12
Location : message
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::message → NO_COVERAGE

13.13
Location : message
Killed by : oghamcloudhopper.it.PartialConfigurationTest.nothingConfiguredAndLongMessageShouldSendOneLongMessageUsingDefaultEncoding(oghamcloudhopper.it.PartialConfigurationTest)
replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::message → KILLED

14.14
Location : message
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::message → TIMED_OUT

116

1.1
Location : every
Killed by : oghamall.it.sms.SmsSMPPGsm7bitTest.longMessage(oghamall.it.sms.SmsSMPPGsm7bitTest)
replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::every → KILLED

2.2
Location : every
Killed by : oghamtesting.it.assertion.FluentSmsAssertionsSpec
replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::every → KILLED

3.3
Location : every
Killed by : oghamcloudhopper.it.CloudhopperSmppTest.severalRecipients(oghamcloudhopper.it.CloudhopperSmppTest)
replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::every → KILLED

4.4
Location : every
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/sms/FluentSmsListAssert::every → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT OGHAM