OghamAssertions.java

1
package fr.sii.ogham.testing.assertion;
2
3
import static java.util.Arrays.asList;
4
5
import java.util.List;
6
import java.util.function.Consumer;
7
8
import javax.mail.internet.MimeMessage;
9
10
import com.icegreen.greenmail.junit4.GreenMailRule;
11
import com.icegreen.greenmail.junit5.GreenMailExtension;
12
13
import fr.sii.ogham.testing.assertion.email.FluentEmailsAssert;
14
import fr.sii.ogham.testing.assertion.email.FluentReceivedEmailsAssert;
15
import fr.sii.ogham.testing.assertion.sms.FluentReceivedSmsAssert;
16
import fr.sii.ogham.testing.assertion.sms.FluentSmsListAssert;
17
import fr.sii.ogham.testing.assertion.util.AssertionRegistry;
18
import fr.sii.ogham.testing.assertion.util.FailAtEndRegistry;
19
import fr.sii.ogham.testing.assertion.util.FailImmediatelyRegistry;
20
import fr.sii.ogham.testing.extension.junit.sms.SmppServerExtension;
21
import fr.sii.ogham.testing.extension.junit.sms.SmppServerRule;
22
import fr.sii.ogham.testing.sms.simulator.bean.SubmitSm;
23
24
/**
25
 * Utility class that helps writing message assertions. For emails, you can
26
 * write something like this:
27
 * 
28
 * <pre>
29
 * {@code
30
 * assertThat(greenMail)
31
 *   .receivedMessages()
32
 *     .count(is(1))
33
 *       .message(0)
34
 *         .subject(is("Test"))
35
 *         .from()
36
 *           .address(hasItems("test.sender@sii.fr"))
37
 *           .and()
38
 *         .to()
39
 *           .address(hasItems("recipient@sii.fr"))
40
 *         .and()
41
 *       .body()
42
 * 		   .contentAsString(is("body"))
43
 *         .contentType(startsWith("text/plain"))
44
 *         .and()
45
 *       .alternative(nullValue())
46
 *       .attachments(hasSize(1))
47
 *         .attachment("04-Java-OOP-Basics.pdf")
48
 * 		     .content(is(resource("/attachment/04-Java-OOP-Basics.pdf")))
49
 *           .contentType(startsWith("application/pdf"))
50
 *           .filename(is("04-Java-OOP-Basics.pdf"))
51
 *           .disposition(is(ATTACHMENT_DISPOSITION));
52
 * }
53
 * </pre>
54
 * 
55
 * For sms, you can write something like this:
56
 * 
57
 * <pre>
58
 * {@code
59
 * assertThat(smppServer)
60
 *   .receivedMessages()
61
 *     .count(is(1))
62
 *       .message(0)
63
 *         .content(is("sms content"))
64
 *         .from()
65
 *           .number(is(INTERNATIONAL_PHONE_NUMBER))
66
 *           .typeOfNumber(is(TypeOfNumber.INTERNATIONAL))
67
 * 		     .numberPlanIndicator(is(NumberingPlanIndicator.ISDN))
68
 *           .and()
69
 *         .to()
70
 *           .number(is(NATIONAL_PHONE_NUMBER))
71
 *           .typeOfNumber(is(TypeOfNumber.UNKNOWN))
72
 * 		     .numberPlanIndicator(is(NumberingPlanIndicator.ISDN));
73
 * }
74
 * </pre>
75
 * 
76
 * 
77
 * @author Aurélien Baudet
78
 *
79
 */
80
public final class OghamAssertions {
81
82
	/**
83
	 * Helper method to write assertions on mails using fluent API. For example:
84
	 * 
85
	 * <pre>
86
	 * {@code
87
	 * assertThat(greenMail).receivedMessages()
88
	 *   .count(is(1))
89
	 *   .message(0)
90
	 *     .subject(is("Test"))
91
	 *     .from().address(hasItems("test.sender@sii.fr")).and()
92
	 *     .to().address(hasItems("recipient@sii.fr")).and()
93
	 *   .body()
94
	 *      .contentAsString(is("body"))
95
	 *      .contentType(startsWith("text/plain")).and()
96
	 *   .alternative(nullValue())
97
	 *   .attachments(hasSize(1))
98
	 *   .attachment("04-Java-OOP-Basics.pdf")
99
	 *      .content(is(resource("/attachment/04-Java-OOP-Basics.pdf")))
100
	 *      .contentType(startsWith("application/pdf"))
101
	 *      .filename(is("04-Java-OOP-Basics.pdf"))
102
	 *      .disposition(is(ATTACHMENT_DISPOSITION));
103
	 * }
104
	 * </pre>
105
	 * 
106
	 * @param greenMail
107
	 *            email server that stores received messages
108
	 * @return builder for fluent assertions on received messages
109
	 */
110
	public static FluentReceivedEmailsAssert assertThat(GreenMailRule greenMail) {
111 5 1. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE
2. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → TIMED_OUT
3. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED
4. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED
5. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED
		return assertThat(greenMail, new FailImmediatelyRegistry());
112
	}
113
114
	/**
115
	 * Helper method to write assertions on mails using fluent API. For example:
116
	 * 
117
	 * <pre>
118
	 * {@code
119
	 * assertAll(registry -> 
120
	 *   assertThat(greenMail, registry).receivedMessages()
121
	 *     .count(is(1))
122
	 *     .message(0)
123
	 *       .subject(is("Test"))
124
	 *       .from().address(hasItems("test.sender@sii.fr")).and()
125
	 *       .to().address(hasItems("recipient@sii.fr")).and()
126
	 *     .body()
127
	 *        .contentAsString(is("body"))
128
	 *        .contentType(startsWith("text/plain")).and()
129
	 *     .alternative(nullValue())
130
	 *     .attachments(hasSize(1))
131
	 *     .attachment("04-Java-OOP-Basics.pdf")
132
	 *        .content(is(resource("/attachment/04-Java-OOP-Basics.pdf")))
133
	 *        .contentType(startsWith("application/pdf"))
134
	 *        .filename(is("04-Java-OOP-Basics.pdf"))
135
	 *        .disposition(is(ATTACHMENT_DISPOSITION)));
136
	 * }
137
	 * </pre>
138
	 * 
139
	 * <p>
140
	 * This method is used in combination of {@link #assertAll(Consumer...)} in
141
	 * order to report all exceptions/assertion failures at the end instead of
142
	 * stopping at the first failure.
143
	 * 
144
	 * @param greenMail
145
	 *            email server that stores received messages
146
	 * @param registry
147
	 *            the registry used to register assertions
148
	 * @return builder for fluent assertions on received messages
149
	 */
150
	public static FluentReceivedEmailsAssert assertThat(GreenMailRule greenMail, AssertionRegistry registry) {
151 5 1. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE
2. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → TIMED_OUT
3. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED
4. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED
5. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED
		return new FluentReceivedEmailsAssert(asList(greenMail.getReceivedMessages()), registry);
152
	}
153
154
	/**
155
	 * Helper method to write assertions on mails using fluent API. For example:
156
	 * 
157
	 * <pre>
158
	 * {@code
159
	 * assertThat(greenMail).receivedMessages()
160
	 *   .count(is(1))
161
	 *   .message(0)
162
	 *     .subject(is("Test"))
163
	 *     .from().address(hasItems("test.sender@sii.fr")).and()
164
	 *     .to().address(hasItems("recipient@sii.fr")).and()
165
	 *   .body()
166
	 *      .contentAsString(is("body"))
167
	 *      .contentType(startsWith("text/plain")).and()
168
	 *   .alternative(nullValue())
169
	 *   .attachments(hasSize(1))
170
	 *   .attachment("04-Java-OOP-Basics.pdf")
171
	 *      .content(is(resource("/attachment/04-Java-OOP-Basics.pdf")))
172
	 *      .contentType(startsWith("application/pdf"))
173
	 *      .filename(is("04-Java-OOP-Basics.pdf"))
174
	 *      .disposition(is(ATTACHMENT_DISPOSITION));
175
	 * }
176
	 * </pre>
177
	 * 
178
	 * @param greenMail
179
	 *            email server that stores received messages
180
	 * @return builder for fluent assertions on received messages
181
	 */
182
	public static FluentReceivedEmailsAssert assertThat(GreenMailExtension greenMail) {
183 1 1. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE
		return assertThat(greenMail, new FailImmediatelyRegistry());
184
	}
185
186
	/**
187
	 * Helper method to write assertions on mails using fluent API. For example:
188
	 * 
189
	 * <pre>
190
	 * {@code
191
	 * assertAll(registry -> 
192
	 *   assertThat(greenMail, registry).receivedMessages()
193
	 *     .count(is(1))
194
	 *     .message(0)
195
	 *       .subject(is("Test"))
196
	 *       .from().address(hasItems("test.sender@sii.fr")).and()
197
	 *       .to().address(hasItems("recipient@sii.fr")).and()
198
	 *     .body()
199
	 *        .contentAsString(is("body"))
200
	 *        .contentType(startsWith("text/plain")).and()
201
	 *     .alternative(nullValue())
202
	 *     .attachments(hasSize(1))
203
	 *     .attachment("04-Java-OOP-Basics.pdf")
204
	 *        .content(is(resource("/attachment/04-Java-OOP-Basics.pdf")))
205
	 *        .contentType(startsWith("application/pdf"))
206
	 *        .filename(is("04-Java-OOP-Basics.pdf"))
207
	 *        .disposition(is(ATTACHMENT_DISPOSITION)));
208
	 * }
209
	 * </pre>
210
	 * 
211
	 * <p>
212
	 * This method is used in combination of {@link #assertAll(Consumer...)} in
213
	 * order to report all exceptions/assertion failures at the end instead of
214
	 * stopping at the first failure.
215
	 * 
216
	 * @param greenMail
217
	 *            email server that stores received messages
218
	 * @param registry
219
	 *            the registry used to register assertions
220
	 * @return builder for fluent assertions on received messages
221
	 */
222
	public static FluentReceivedEmailsAssert assertThat(GreenMailExtension greenMail, AssertionRegistry registry) {
223 1 1. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE
		return new FluentReceivedEmailsAssert(asList(greenMail.getReceivedMessages()), registry);
224
	}
225
226
	/**
227
	 * Helper method to write assertions on mails using fluent API. For example:
228
	 * 
229
	 * <pre>
230
	 * {@code
231
	 * assertThat(greenMail.getReceivedMessages())
232
	 *   .count(is(1))
233
	 *   .message(0)
234
	 *     .subject(is("Test"))
235
	 *     .from().address(hasItems("test.sender@sii.fr")).and()
236
	 *     .to().address(hasItems("recipient@sii.fr")).and()
237
	 *   .body()
238
	 *      .contentAsString(is("body"))
239
	 *      .contentType(startsWith("text/plain")).and()
240
	 *   .alternative(nullValue())
241
	 *   .attachments(hasSize(1))
242
	 *   .attachment("04-Java-OOP-Basics.pdf")
243
	 *      .content(is(resource("/attachment/04-Java-OOP-Basics.pdf")))
244
	 *      .contentType(startsWith("application/pdf"))
245
	 *      .filename(is("04-Java-OOP-Basics.pdf"))
246
	 *      .disposition(is(ATTACHMENT_DISPOSITION));
247
	 * }
248
	 * </pre>
249
	 * 
250
	 * @param receivedEmails
251
	 *            list of messages received by the email server
252
	 * @return builder for fluent assertions on received messages
253
	 */
254
	public static FluentEmailsAssert<Void> assertThat(MimeMessage[] receivedEmails) {
255 2 1. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE
2. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED
		return assertThat(receivedEmails, new FailImmediatelyRegistry());
256
	}
257
258
	/**
259
	 * Helper method to write assertions on mails using fluent API. For example:
260
	 * 
261
	 * <pre>
262
	 * {@code
263
	 * assertAll(registry -> 
264
	 *   assertThat(greenMail.getReceivedMessages(), registry)
265
	 *     .count(is(1))
266
	 *     .message(0)
267
	 *       .subject(is("Test"))
268
	 *       .from().address(hasItems("test.sender@sii.fr")).and()
269
	 *       .to().address(hasItems("recipient@sii.fr")).and()
270
	 *     .body()
271
	 *        .contentAsString(is("body"))
272
	 *        .contentType(startsWith("text/plain")).and()
273
	 *     .alternative(nullValue())
274
	 *     .attachments(hasSize(1))
275
	 *     .attachment("04-Java-OOP-Basics.pdf")
276
	 *        .content(is(resource("/attachment/04-Java-OOP-Basics.pdf")))
277
	 *        .contentType(startsWith("application/pdf"))
278
	 *        .filename(is("04-Java-OOP-Basics.pdf"))
279
	 *        .disposition(is(ATTACHMENT_DISPOSITION)));
280
	 * }
281
	 * </pre>
282
	 * 
283
	 * <p>
284
	 * This method is used in combination of {@link #assertAll(Consumer...)} in
285
	 * order to report all exceptions/assertion failures at the end instead of
286
	 * stopping at the first failure.
287
	 * 
288
	 * @param receivedEmails
289
	 *            list of messages received by the email server
290
	 * @param registry
291
	 *            the registry used to register assertions
292
	 * @return builder for fluent assertions on received messages
293
	 */
294
	public static FluentEmailsAssert<Void> assertThat(MimeMessage[] receivedEmails, AssertionRegistry registry) {
295 2 1. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE
2. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED
		return new FluentEmailsAssert<>(asList(receivedEmails), null, registry);
296
	}
297
298
	/**
299
	 * Helper method to write assertions on sms using fluent API. For example:
300
	 * 
301
	 * <pre>
302
	 * {@code
303
	 * assertThat(smppServer).receivedMessages()
304
	 *   .count(is(1))
305
	 *   .message(0)
306
	 *     .content(is("sms content"))
307
	 *     .from()
308
	 *       .number(is(INTERNATIONAL_PHONE_NUMBER))
309
	 *       .typeOfNumber(is(TypeOfNumber.INTERNATIONAL))
310
	 *       .numberPlanIndicator(is(NumberingPlanIndicator.ISDN)).and()
311
	 *     .to()
312
	 *       .number(is(NATIONAL_PHONE_NUMBER))
313
	 *       .typeOfNumber(is(TypeOfNumber.UNKNOWN))
314
	 *       .numberPlanIndicator(is(NumberingPlanIndicator.ISDN));
315
	 * }
316
	 * </pre>
317
	 * 
318
	 * @param smsServer
319
	 *            SMS server that stores received messages
320
	 * @param <M>
321
	 *            the type of messages handled by the server
322
	 * @return builder for fluent assertions on received messages
323
	 */
324
	public static <M> FluentReceivedSmsAssert<SubmitSm> assertThat(SmppServerRule<M> smsServer) {
325 5 1. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE
2. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → TIMED_OUT
3. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED
4. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED
5. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED
		return assertThat(smsServer, new FailImmediatelyRegistry());
326
	}
327
328
	/**
329
	 * Helper method to write assertions on sms using fluent API. For example:
330
	 * 
331
	 * <pre>
332
	 * {@code
333
	 * assertThat(smppServer).receivedMessages()
334
	 *   .count(is(1))
335
	 *   .message(0)
336
	 *     .content(is("sms content"))
337
	 *     .from()
338
	 *       .number(is(INTERNATIONAL_PHONE_NUMBER))
339
	 *       .typeOfNumber(is(TypeOfNumber.INTERNATIONAL))
340
	 *       .numberPlanIndicator(is(NumberingPlanIndicator.ISDN)).and()
341
	 *     .to()
342
	 *       .number(is(NATIONAL_PHONE_NUMBER))
343
	 *       .typeOfNumber(is(TypeOfNumber.UNKNOWN))
344
	 *       .numberPlanIndicator(is(NumberingPlanIndicator.ISDN));
345
	 * }
346
	 * </pre>
347
	 * 
348
	 * @param smsServer
349
	 *            SMS server that stores received messages
350
	 * @param <M>
351
	 *            the type of messages handled by the server
352
	 * @return builder for fluent assertions on received messages
353
	 */
354
	public static <M> FluentReceivedSmsAssert<SubmitSm> assertThat(SmppServerExtension<M> smsServer) {
355 1 1. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE
		return assertThat(smsServer, new FailImmediatelyRegistry());
356
	}
357
358
	/**
359
	 * Helper method to write assertions on sms using fluent API. For example:
360
	 * 
361
	 * <pre>
362
	 * {@code
363
	 * assertAll(registry ->
364
	 *   assertThat(smppServer, registry).receivedMessages()
365
	 *     .count(is(1))
366
	 *     .message(0)
367
	 *       .content(is("sms content"))
368
	 *       .from()
369
	 *         .number(is(INTERNATIONAL_PHONE_NUMBER))
370
	 *         .typeOfNumber(is(TypeOfNumber.INTERNATIONAL))
371
	 *         .numberPlanIndicator(is(NumberingPlanIndicator.ISDN)).and()
372
	 *       .to()
373
	 *         .number(is(NATIONAL_PHONE_NUMBER))
374
	 *         .typeOfNumber(is(TypeOfNumber.UNKNOWN))
375
	 *         .numberPlanIndicator(is(NumberingPlanIndicator.ISDN)));
376
	 * }
377
	 * </pre>
378
	 * 
379
	 * <p>
380
	 * This method is used in combination of {@link #assertAll(Consumer...)} in
381
	 * order to report all exceptions/assertion failures at the end instead of
382
	 * stopping at the first failure.
383
	 * 
384
	 * @param smsServer
385
	 *            SMS server that stores received messages
386
	 * @param registry
387
	 *            the registry used to register assertions
388
	 * @param <M>
389
	 *            the type of messages handled by the server
390
	 * @return builder for fluent assertions on received messages
391
	 */
392
	public static <M> FluentReceivedSmsAssert<SubmitSm> assertThat(SmppServerRule<M> smsServer, AssertionRegistry registry) {
393 5 1. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE
2. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → TIMED_OUT
3. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED
4. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED
5. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED
		return new FluentReceivedSmsAssert<>(smsServer.getReceivedMessages(), registry);
394
	}
395
396
	/**
397
	 * Helper method to write assertions on sms using fluent API. For example:
398
	 * 
399
	 * <pre>
400
	 * {@code
401
	 * assertAll(registry ->
402
	 *   assertThat(smppServer, registry).receivedMessages()
403
	 *     .count(is(1))
404
	 *     .message(0)
405
	 *       .content(is("sms content"))
406
	 *       .from()
407
	 *         .number(is(INTERNATIONAL_PHONE_NUMBER))
408
	 *         .typeOfNumber(is(TypeOfNumber.INTERNATIONAL))
409
	 *         .numberPlanIndicator(is(NumberingPlanIndicator.ISDN)).and()
410
	 *       .to()
411
	 *         .number(is(NATIONAL_PHONE_NUMBER))
412
	 *         .typeOfNumber(is(TypeOfNumber.UNKNOWN))
413
	 *         .numberPlanIndicator(is(NumberingPlanIndicator.ISDN)));
414
	 * }
415
	 * </pre>
416
	 * 
417
	 * <p>
418
	 * This method is used in combination of {@link #assertAll(Consumer...)} in
419
	 * order to report all exceptions/assertion failures at the end instead of
420
	 * stopping at the first failure.
421
	 * 
422
	 * @param smsServer
423
	 *            SMS server that stores received messages
424
	 * @param registry
425
	 *            the registry used to register assertions
426
	 * @param <M>
427
	 *            the type of messages handled by the server
428
	 * @return builder for fluent assertions on received messages
429
	 */
430
	public static <M> FluentReceivedSmsAssert<SubmitSm> assertThat(SmppServerExtension<M> smsServer, AssertionRegistry registry) {
431 1 1. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE
		return new FluentReceivedSmsAssert<>(smsServer.getReceivedMessages(), registry);
432
	}
433
434
	/**
435
	 * Helper method to write assertions on sms using fluent API. For example:
436
	 * 
437
	 * <pre>
438
	 * {@code
439
	 * assertThat(smppServer.getReceivedMessages())
440
	 *   .count(is(1))
441
	 *   .message(0)
442
	 *     .content(is("sms content"))
443
	 *     .from()
444
	 *       .number(is(INTERNATIONAL_PHONE_NUMBER))
445
	 *       .typeOfNumber(is(TypeOfNumber.INTERNATIONAL))
446
	 *       .numberPlanIndicator(is(NumberingPlanIndicator.ISDN)).and()
447
	 *     .to()
448
	 *       .number(is(NATIONAL_PHONE_NUMBER))
449
	 *       .typeOfNumber(is(TypeOfNumber.UNKNOWN))
450
	 *       .numberPlanIndicator(is(NumberingPlanIndicator.ISDN));
451
	 * }
452
	 * </pre>
453
	 * 
454
	 * @param receivedSms
455
	 *            The list of messages received by the SMS server
456
	 * @return builder for fluent assertions on received messages
457
	 */
458
	public static FluentSmsListAssert<Void, SubmitSm> assertThat(List<SubmitSm> receivedSms) {
459 3 1. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE
2. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED
3. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED
		return assertThat(receivedSms, new FailImmediatelyRegistry());
460
	}
461
462
	/**
463
	 * Helper method to write assertions on sms using fluent API. For example:
464
	 * 
465
	 * <pre>
466
	 * {@code
467
	 * assertAll(registry ->
468
	 *   assertThat(smppServer.getReceivedMessages(), registry)
469
	 *     .count(is(1))
470
	 *     .message(0)
471
	 *       .content(is("sms content"))
472
	 *       .from()
473
	 *         .number(is(INTERNATIONAL_PHONE_NUMBER))
474
	 *         .typeOfNumber(is(TypeOfNumber.INTERNATIONAL))
475
	 *         .numberPlanIndicator(is(NumberingPlanIndicator.ISDN)).and()
476
	 *       .to()
477
	 *         .number(is(NATIONAL_PHONE_NUMBER))
478
	 *         .typeOfNumber(is(TypeOfNumber.UNKNOWN))
479
	 *         .numberPlanIndicator(is(NumberingPlanIndicator.ISDN)));
480
	 * }
481
	 * </pre>
482
	 * 
483
	 * <p>
484
	 * This method is used in combination of {@link #assertAll(Consumer...)} in
485
	 * order to report all exceptions/assertion failures at the end instead of
486
	 * stopping at the first failure.
487
	 * 
488
	 * @param receivedSms
489
	 *            The list of messages received by the SMS server
490
	 * @param registry
491
	 *            the registry used to register assertions
492
	 * @return builder for fluent assertions on received messages
493
	 */
494
	public static FluentSmsListAssert<Void, SubmitSm> assertThat(List<SubmitSm> receivedSms, AssertionRegistry registry) {
495 3 1. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE
2. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED
3. assertThat : replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED
		return new FluentSmsListAssert<>(receivedSms, null, registry);
496
	}
497
498
	/**
499
	 * Register all assertions in order to report all failures/failed assertions
500
	 * at once instead of reporting error one by one.
501
	 * 
502
	 * <pre>
503
	 * {@code
504
	 * assertAll(registry -> 
505
	 *   assertThat(smppServer.getReceivedMessages(), registry)
506
	 *     .count(is(1))
507
	 *     .message(0)
508
	 *       .content(is("sms content"))
509
	 *       .from()
510
	 *         .number(is(INTERNATIONAL_PHONE_NUMBER))
511
	 *         .typeOfNumber(is(TypeOfNumber.INTERNATIONAL))
512
	 *         .numberPlanIndicator(is(NumberingPlanIndicator.ISDN)).and()
513
	 *       .to()
514
	 *         .number(is(NATIONAL_PHONE_NUMBER))
515
	 *         .typeOfNumber(is(TypeOfNumber.UNKNOWN))
516
	 *         .numberPlanIndicator(is(NumberingPlanIndicator.ISDN)));
517
	 * }
518
	 * </pre>
519
	 * 
520
	 * 
521
	 * @param executables
522
	 *            the list of functions to register
523
	 */
524
	@SafeVarargs
525
	public static void assertAll(Consumer<AssertionRegistry>... executables) {
526
		AssertionRegistry registry = new FailAtEndRegistry();
527
		for (Consumer<AssertionRegistry> executable : executables) {
528 2 1. assertAll : removed call to java/util/function/Consumer::accept → NO_COVERAGE
2. assertAll : removed call to java/util/function/Consumer::accept → KILLED
			executable.accept(registry);
529
		}
530 2 1. assertAll : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::execute → NO_COVERAGE
2. assertAll : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::execute → KILLED
		registry.execute();
531
	}
532
533
	private OghamAssertions() {
534
		super();
535
	}
536
537
}

Mutations

111

1.1
Location : assertThat
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED

2.2
Location : assertThat
Killed by : oghamall.it.configuration.EmptyBuilderTest.manualJavaMailConfigurationCanSendEmail(oghamall.it.configuration.EmptyBuilderTest)
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED

3.3
Location : assertThat
Killed by : oghamjavamail.it.JavaMailSmtpTest.simple(oghamjavamail.it.JavaMailSmtpTest)
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED

4.4
Location : assertThat
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → TIMED_OUT

5.5
Location : assertThat
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE

151

1.1
Location : assertThat
Killed by : oghamjavamail.it.JavaMailSmtpTest.simple(oghamjavamail.it.JavaMailSmtpTest)
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED

2.2
Location : assertThat
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE

3.3
Location : assertThat
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED

4.4
Location : assertThat
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → TIMED_OUT

5.5
Location : assertThat
Killed by : oghamall.it.configuration.EmptyBuilderTest.manualJavaMailConfigurationCanSendEmail(oghamall.it.configuration.EmptyBuilderTest)
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED

183

1.1
Location : assertThat
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE

223

1.1
Location : assertThat
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE

255

1.1
Location : assertThat
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED

2.2
Location : assertThat
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE

295

1.1
Location : assertThat
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE

2.2
Location : assertThat
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED

325

1.1
Location : assertThat
Killed by : oghamtesting.it.assertion.FluentSmsAssertionsSpec
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED

2.2
Location : assertThat
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → TIMED_OUT

3.3
Location : assertThat
Killed by : oghamcloudhopper.it.PartialConfigurationTest.nothingConfiguredAndLongMessageShouldSendOneLongMessageUsingDefaultEncoding(oghamcloudhopper.it.PartialConfigurationTest)
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED

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

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

355

1.1
Location : assertThat
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE

393

1.1
Location : assertThat
Killed by : oghamtesting.it.assertion.FluentSmsAssertionsSpec
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED

2.2
Location : assertThat
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE

3.3
Location : assertThat
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → TIMED_OUT

4.4
Location : assertThat
Killed by : oghamcloudhopper.it.PartialConfigurationTest.nothingConfiguredAndLongMessageShouldSendOneLongMessageUsingDefaultEncoding(oghamcloudhopper.it.PartialConfigurationTest)
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED

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

431

1.1
Location : assertThat
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE

459

1.1
Location : assertThat
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → NO_COVERAGE

2.2
Location : assertThat
Killed by : oghamcloudhopper.it.ReuseSessionStrategyTest.reuseSessionButEnquireLinkTimeout(oghamcloudhopper.it.ReuseSessionStrategyTest)
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED

3.3
Location : assertThat
Killed by : oghamtesting.it.assertion.FluentSmsAssertionsSpec
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED

495

1.1
Location : assertThat
Killed by : oghamtesting.it.assertion.FluentSmsAssertionsSpec
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED

2.2
Location : assertThat
Killed by : oghamcloudhopper.it.ReuseSessionStrategyTest.reuseSessionButEnquireLinkTimeout(oghamcloudhopper.it.ReuseSessionStrategyTest)
replaced return value with null for fr/sii/ogham/testing/assertion/OghamAssertions::assertThat → KILLED

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

528

1.1
Location : assertAll
Killed by : none
removed call to java/util/function/Consumer::accept → NO_COVERAGE

2.2
Location : assertAll
Killed by : oghamtesting.it.assertion.FluentSmsAssertionsSpec
removed call to java/util/function/Consumer::accept → KILLED

530

1.1
Location : assertAll
Killed by : oghamtesting.it.assertion.FluentSmsAssertionsSpec
removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::execute → KILLED

2.2
Location : assertAll
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::execute → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT OGHAM