FluentPartAssert.java

1
package fr.sii.ogham.testing.assertion.email;
2
3
import static fr.sii.ogham.testing.assertion.util.AssertionHelper.assertThat;
4
import static fr.sii.ogham.testing.assertion.util.AssertionHelper.usingContext;
5
import static fr.sii.ogham.testing.assertion.util.EmailUtils.getContent;
6
import static java.util.Arrays.asList;
7
import static java.util.Collections.list;
8
9
import java.nio.charset.Charset;
10
import java.nio.charset.StandardCharsets;
11
import java.util.Arrays;
12
import java.util.List;
13
14
import javax.mail.Header;
15
import javax.mail.MessagingException;
16
import javax.mail.Part;
17
18
import org.hamcrest.Matcher;
19
20
import fr.sii.ogham.testing.assertion.util.AssertionRegistry;
21
import fr.sii.ogham.testing.util.HasParent;
22
23
public class FluentPartAssert<P> extends HasParent<P> {
24
	/**
25
	 * The list of messages that will be used for assertions
26
	 */
27
	private final List<PartWithContext> actual;
28
	/**
29
	 * Registry to register assertions
30
	 */
31
	private final AssertionRegistry registry;
32
33
	public FluentPartAssert(PartWithContext actual, P parent, AssertionRegistry registry) {
34
		this(Arrays.asList(actual), parent, registry);
35
	}
36
37
	public FluentPartAssert(List<PartWithContext> actual, P parent, AssertionRegistry registry) {
38
		super(parent);
39
		this.actual = actual;
40
		this.registry = registry;
41
	}
42
43
	/**
44
	 * Make assertions on the string content of a part (body, alternative or
45
	 * attachment) of the message(s). UTF-8 charset is used to decode body
46
	 * content.
47
	 * 
48
	 * <pre>
49
	 * .receivedMessages().message(0).body()
50
	 *    .contentAsString(is("foobar"))
51
	 * </pre>
52
	 * 
53
	 * Will check if the content of the body of the first message is exactly
54
	 * "foobar".
55
	 * 
56
	 * <pre>
57
	 * .receivedMessages().every().body()
58
	 *    .contentAsString(is("foobar"))
59
	 * </pre>
60
	 * 
61
	 * Will check if the content of the body of every message is exactly
62
	 * "foobar".
63
	 * 
64
	 * @param matcher
65
	 *            the assertion to apply on string content
66
	 * @return the fluent API for chaining assertions on received message(s)
67
	 */
68
	public FluentPartAssert<P> contentAsString(Matcher<? super String> matcher) {
69 5 1. contentAsString : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentAsString → NO_COVERAGE
2. contentAsString : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentAsString → TIMED_OUT
3. contentAsString : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentAsString → KILLED
4. contentAsString : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentAsString → KILLED
5. contentAsString : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentAsString → KILLED
		return contentAsString(matcher, StandardCharsets.UTF_8);
70
	}
71
72
	/**
73
	 * Make assertions on the string content of a part (body, alternative or
74
	 * attachment) of the message(s).
75
	 * 
76
	 * <pre>
77
	 * .receivedMessages().message(0).body()
78
	 *    .contentAsString(is("foobar"), Charset.forName("UTF-8"))
79
	 * </pre>
80
	 * 
81
	 * Will check if the content of the body of the first message is exactly
82
	 * "foobar".
83
	 * 
84
	 * <pre>
85
	 * .receivedMessages().every().body()
86
	 *    .contentAsString(is("foobar"), Charset.forName("UTF-8"))
87
	 * </pre>
88
	 * 
89
	 * Will check if the content of the body of every message is exactly
90
	 * "foobar".
91
	 * 
92
	 * @param matcher
93
	 *            the assertion to apply on string content
94
	 * @param charset
95
	 *            the charset used to decode the content
96
	 * @return the fluent API for chaining assertions on received message(s)
97
	 */
98
	public FluentPartAssert<P> contentAsString(Matcher<? super String> matcher, Charset charset) {
99
		try {
100
			String message = charset.name() + " content of ${partName} of message ${messageIndex}";
101
			for (PartWithContext partWithContext : actual) {
102
				Part part = partWithContext.getPart();
103 13 1. contentAsString : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → SURVIVED
2. contentAsString : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → NO_COVERAGE
3. lambda$contentAsString$0 : negated conditional → NO_COVERAGE
4. lambda$contentAsString$0 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → SURVIVED
5. lambda$contentAsString$0 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → NO_COVERAGE
6. contentAsString : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → TIMED_OUT
7. lambda$contentAsString$0 : negated conditional → TIMED_OUT
8. lambda$contentAsString$0 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → TIMED_OUT
9. contentAsString : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → KILLED
10. lambda$contentAsString$0 : negated conditional → KILLED
11. lambda$contentAsString$0 : negated conditional → KILLED
12. lambda$contentAsString$0 : negated conditional → KILLED
13. lambda$contentAsString$0 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → KILLED
				registry.register(() -> assertThat(part == null ? null : getContent(part, charset), usingContext(message, partWithContext, matcher)));
104
			}
105 5 1. contentAsString : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentAsString → NO_COVERAGE
2. contentAsString : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentAsString → TIMED_OUT
3. contentAsString : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentAsString → KILLED
4. contentAsString : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentAsString → KILLED
5. contentAsString : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentAsString → KILLED
			return this;
106
		} catch (Exception e) {
107
			throw new AssertionError("Failed to get string content for part", e);
108
		}
109
	}
110
111
	/**
112
	 * Make assertions on the raw content of a part (body, alternative or
113
	 * attachment) of the message(s).
114
	 * 
115
	 * <pre>
116
	 * .receivedMessages().message(0).body()
117
	 *    .content(is(resource("path/to/expected/file"))
118
	 * </pre>
119
	 * 
120
	 * Will check if the content of the body of the first message is exactly the
121
	 * same as the file resource available in the classpath.
122
	 * 
123
	 * <pre>
124
	 * .receivedMessages().every().body()
125
	 *    .content(is(resource("path/to/expected/file"))
126
	 * </pre>
127
	 * 
128
	 * Will check if the content of the body of every message is exactly the
129
	 * same as the file resource available in the classpath.
130
	 * 
131
	 * @param matcher
132
	 *            the assertion to apply on raw content
133
	 * @return the fluent API for chaining assertions on received message(s)
134
	 */
135
	public FluentPartAssert<P> content(Matcher<byte[]> matcher) {
136
		try {
137
			String message = "raw content of ${partName} of message ${messageIndex}";
138
			for (PartWithContext partWithContext : actual) {
139
				Part part = partWithContext.getPart();
140 10 1. content : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → SURVIVED
2. content : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → NO_COVERAGE
3. lambda$content$1 : negated conditional → NO_COVERAGE
4. lambda$content$1 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → SURVIVED
5. lambda$content$1 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → NO_COVERAGE
6. content : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → KILLED
7. lambda$content$1 : negated conditional → KILLED
8. lambda$content$1 : negated conditional → KILLED
9. lambda$content$1 : negated conditional → KILLED
10. lambda$content$1 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → KILLED
				registry.register(() -> assertThat(part == null ? null : getContent(part), usingContext(message, partWithContext, matcher)));
141
			}
142 4 1. content : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::content → NO_COVERAGE
2. content : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::content → KILLED
3. content : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::content → KILLED
4. content : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::content → KILLED
			return this;
143
		} catch (Exception e) {
144
			throw new AssertionError("Failed to get content for part", e);
145
		}
146
	}
147
148
	/**
149
	 * Make assertions on the content-type of a part (body, alternative or
150
	 * attachment) of the message(s).
151
	 * 
152
	 * <pre>
153
	 * .receivedMessages().message(0).body()
154
	 *    .contentType(is("text/html"))
155
	 * </pre>
156
	 * 
157
	 * Will check if the content-type of the body of the first message is
158
	 * exactly "text/html".
159
	 * 
160
	 * <pre>
161
	 * .receivedMessages().every().body()
162
	 *    .contentType(is("text/html"))
163
	 * </pre>
164
	 * 
165
	 * Will check if the content-type of the body of every message is exactly
166
	 * "text/html".
167
	 * 
168
	 * @param matcher
169
	 *            the assertion to apply on content-type
170
	 * @return the fluent API for chaining assertions on received message(s)
171
	 */
172
	public FluentPartAssert<P> contentType(Matcher<? super String> matcher) {
173
		try {
174
			String message = "content-type of ${partName} of message ${messageIndex}";
175
			for (PartWithContext partWithContext : actual) {
176
				Part part = partWithContext.getPart();
177 10 1. contentType : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → SURVIVED
2. contentType : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → NO_COVERAGE
3. lambda$contentType$2 : negated conditional → NO_COVERAGE
4. lambda$contentType$2 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → NO_COVERAGE
5. lambda$contentType$2 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → SURVIVED
6. contentType : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → KILLED
7. lambda$contentType$2 : negated conditional → KILLED
8. lambda$contentType$2 : negated conditional → KILLED
9. lambda$contentType$2 : negated conditional → KILLED
10. lambda$contentType$2 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → KILLED
				registry.register(() -> assertThat(part == null ? null : part.getContentType(), usingContext(message, partWithContext, matcher)));
178
			}
179 4 1. contentType : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentType → NO_COVERAGE
2. contentType : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentType → KILLED
3. contentType : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentType → KILLED
4. contentType : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentType → KILLED
			return this;
180
		} catch (MessagingException e) {
181
			throw new AssertionError("Failed to get string content type for part", e);
182
		}
183
	}
184
185
	/**
186
	 * Make assertions on the description of a part (body, alternative or
187
	 * attachment) of the message(s).
188
	 * 
189
	 * <pre>
190
	 * .receivedMessages().message(0).body()
191
	 *    .description(is("foo bar"))
192
	 * </pre>
193
	 * 
194
	 * Will check if the description of the body of the first message is exactly
195
	 * "foo bar".
196
	 * 
197
	 * <pre>
198
	 * .receivedMessages().every().body()
199
	 *    .description(is("foo bar"))
200
	 * </pre>
201
	 * 
202
	 * Will check if the description of the body of every message is exactly
203
	 * "foo bar".
204
	 * 
205
	 * @param matcher
206
	 *            the assertion to apply on description
207
	 * @return the fluent API for chaining assertions on received message(s)
208
	 */
209
	public FluentPartAssert<P> description(Matcher<? super String> matcher) {
210
		try {
211
			String message = "description of ${partName} of message ${messageIndex}";
212
			for (PartWithContext partWithContext : actual) {
213
				Part part = partWithContext.getPart();
214 6 1. description : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → NO_COVERAGE
2. lambda$description$3 : negated conditional → NO_COVERAGE
3. lambda$description$3 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → NO_COVERAGE
4. description : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → KILLED
5. lambda$description$3 : negated conditional → KILLED
6. lambda$description$3 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → KILLED
				registry.register(() -> assertThat(part == null ? null : part.getDescription(), usingContext(message, partWithContext, matcher)));
215
			}
216 2 1. description : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::description → NO_COVERAGE
2. description : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::description → KILLED
			return this;
217
		} catch (MessagingException e) {
218
			throw new AssertionError("Failed to get description of part", e);
219
		}
220
	}
221
222
	/**
223
	 * Make assertions on the disposition of a part (body, alternative or
224
	 * attachment) of the message(s).
225
	 * 
226
	 * <pre>
227
	 * .receivedMessages().message(0).body()
228
	 *    .disposition(is(INLINE_DISPOSITION))
229
	 * </pre>
230
	 * 
231
	 * Will check if the disposition of the body of the first message is exactly
232
	 * "inline".
233
	 * 
234
	 * <pre>
235
	 * .receivedMessages().every().body()
236
	 *    .disposition(is(INLINE_DISPOSITION))
237
	 * </pre>
238
	 * 
239
	 * Will check if the disposition of the body of every message is exactly
240
	 * "inline".
241
	 * 
242
	 * @param matcher
243
	 *            the assertion to apply on disposition
244
	 * @return the fluent API for chaining assertions on received message(s)
245
	 */
246
	public FluentPartAssert<P> disposition(Matcher<? super String> matcher) {
247
		try {
248
			String message = "disposition of ${partName} of message ${messageIndex}";
249
			for (PartWithContext partWithContext : actual) {
250
				Part part = partWithContext.getPart();
251 10 1. disposition : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → SURVIVED
2. disposition : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → NO_COVERAGE
3. lambda$disposition$4 : negated conditional → NO_COVERAGE
4. lambda$disposition$4 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → NO_COVERAGE
5. lambda$disposition$4 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → SURVIVED
6. disposition : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → KILLED
7. lambda$disposition$4 : negated conditional → KILLED
8. lambda$disposition$4 : negated conditional → KILLED
9. lambda$disposition$4 : negated conditional → KILLED
10. lambda$disposition$4 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → KILLED
				registry.register(() -> assertThat(part == null ? null : part.getDisposition(), usingContext(message, partWithContext, matcher)));
252
			}
253 4 1. disposition : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::disposition → SURVIVED
2. disposition : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::disposition → NO_COVERAGE
3. disposition : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::disposition → KILLED
4. disposition : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::disposition → KILLED
			return this;
254
		} catch (MessagingException e) {
255
			throw new AssertionError("Failed to get disposition of part", e);
256
		}
257
	}
258
259
	/**
260
	 * Make assertions on the filename of a part (body, alternative or
261
	 * attachment) of the message(s).
262
	 * 
263
	 * <pre>
264
	 * .receivedMessages().message(0).attachment(0)
265
	 *    .filename(is("foo.pdf"))
266
	 * </pre>
267
	 * 
268
	 * Will check if the filename of the first attachment of the first message
269
	 * is exactly "foo.pdf".
270
	 * 
271
	 * <pre>
272
	 * .receivedMessages().every().attachment(0)
273
	 *    .filename(is("foo.pdf"))
274
	 * </pre>
275
	 * 
276
	 * Will check if the filename of the first attachment of every message is
277
	 * exactly "foo.pdf".
278
	 * 
279
	 * @param matcher
280
	 *            the assertion to apply on filename
281
	 * @return the fluent API for chaining assertions on received message(s)
282
	 */
283
	public FluentPartAssert<P> filename(Matcher<? super String> matcher) {
284
		try {
285
			String message = "filename of ${partName} of message ${messageIndex}";
286
			for (PartWithContext partWithContext : actual) {
287
				Part part = partWithContext.getPart();
288 10 1. filename : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → NO_COVERAGE
2. filename : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → SURVIVED
3. lambda$filename$5 : negated conditional → NO_COVERAGE
4. lambda$filename$5 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → NO_COVERAGE
5. lambda$filename$5 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → SURVIVED
6. filename : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → KILLED
7. lambda$filename$5 : negated conditional → KILLED
8. lambda$filename$5 : negated conditional → KILLED
9. lambda$filename$5 : negated conditional → KILLED
10. lambda$filename$5 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → KILLED
				registry.register(() -> assertThat(part == null ? null : part.getFileName(), usingContext(message, partWithContext, matcher)));
289
			}
290 4 1. filename : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::filename → NO_COVERAGE
2. filename : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::filename → KILLED
3. filename : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::filename → KILLED
4. filename : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::filename → KILLED
			return this;
291
		} catch (MessagingException e) {
292
			throw new AssertionError("Failed to get filename of part", e);
293
		}
294
	}
295
296
	/**
297
	 * Make assertions on the headers of a part (body, alternative or
298
	 * attachment) of the message(s).
299
	 * 
300
	 * <pre>
301
	 * .receivedMessages().message(0).attachment(0)
302
	 *    .headers(hasItem(new Header("name", "value")))
303
	 * </pre>
304
	 * 
305
	 * Will check if the headers of the first attachment of the first message
306
	 * contains a header with name "name" and value "value".
307
	 * 
308
	 * <pre>
309
	 * .receivedMessages().every().attachment(0)
310
	 *    .header(hasItem(new Header("name", "value")))
311
	 * </pre>
312
	 * 
313
	 * Will check if the headers of the first attachment of every message is
314
	 * contains a header with name "name" and value "value".
315
	 * 
316
	 * @param matcher
317
	 *            the assertion to apply on headers
318
	 * @return the fluent API for chaining assertions on received message(s)
319
	 */
320
	public FluentPartAssert<P> headers(Matcher<? super Iterable<Header>> matcher) {
321
		try {
322
			String message = "headers of ${partName} of message ${messageIndex}";
323
			for (PartWithContext partWithContext : actual) {
324
				Part part = partWithContext.getPart();
325 3 1. headers : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → NO_COVERAGE
2. lambda$headers$6 : negated conditional → NO_COVERAGE
3. lambda$headers$6 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → NO_COVERAGE
				registry.register(() -> assertThat(part == null ? null : list(part.getAllHeaders()), usingContext(message, partWithContext, matcher)));
326
			}
327 1 1. headers : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::headers → NO_COVERAGE
			return this;
328
		} catch (MessagingException e) {
329
			throw new AssertionError("Failed to get headers of part", e);
330
		}
331
	}
332
333
	/**
334
	 * Make assertions on a single header of a part (body, alternative or
335
	 * attachment) of the message(s).
336
	 * 
337
	 * <pre>
338
	 * .receivedMessages().message(0).attachment(0)
339
	 *    .header("Content-ID", contains("foo"))
340
	 * </pre>
341
	 * 
342
	 * Will check if the "Content-ID" header of the first attachment of the
343
	 * first message values "foo".
344
	 * 
345
	 * <pre>
346
	 * .receivedMessages().every().attachment(0)
347
	 *    .header("Content-ID", contains("foo"))
348
	 * </pre>
349
	 * 
350
	 * Will check if the "Content-ID" header of the first attachment of every
351
	 * message values "foo".
352
	 * 
353
	 * @param headerName
354
	 *            the name of the header to check
355
	 * @param matcher
356
	 *            the assertion to apply on the header header
357
	 * @return the fluent API for chaining assertions on received message(s)
358
	 */
359
	public FluentPartAssert<P> header(String headerName, Matcher<? super Iterable<String>> matcher) {
360
		try {
361
			String message = "header " + headerName + " of ${partName} of message ${messageIndex}";
362
			for (PartWithContext partWithContext : actual) {
363
				Part part = partWithContext.getPart();
364 6 1. header : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → NO_COVERAGE
2. header : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → SURVIVED
3. lambda$header$7 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → NO_COVERAGE
4. lambda$header$7 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → SURVIVED
5. header : removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → KILLED
6. lambda$header$7 : removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → KILLED
				registry.register(() -> assertThat(getHeaderValues(part, headerName), usingContext(message, partWithContext, matcher)));
365
			}
366 3 1. header : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::header → NO_COVERAGE
2. header : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::header → SURVIVED
3. header : replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::header → KILLED
			return this;
367
		} catch (MessagingException e) {
368
			throw new AssertionError("Failed to get header" + headerName + " of part", e);
369
		}
370
	}
371
	
372
	@SuppressWarnings("squid:S1168")
373
	private static List<String> getHeaderValues(Part part, String headerName) throws MessagingException {
374 3 1. getHeaderValues : negated conditional → NO_COVERAGE
2. getHeaderValues : negated conditional → KILLED
3. getHeaderValues : negated conditional → KILLED
		if (part != null) {
375
			String[] vals = part.getHeader(headerName);
376 3 1. getHeaderValues : negated conditional → NO_COVERAGE
2. getHeaderValues : negated conditional → KILLED
3. getHeaderValues : negated conditional → KILLED
			if (vals != null) {
377 3 1. getHeaderValues : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/email/FluentPartAssert::getHeaderValues → NO_COVERAGE
2. getHeaderValues : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/email/FluentPartAssert::getHeaderValues → KILLED
3. getHeaderValues : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/email/FluentPartAssert::getHeaderValues → KILLED
				return asList(vals);
378
			}
379
		}
380 2 1. getHeaderValues : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/email/FluentPartAssert::getHeaderValues → NO_COVERAGE
2. getHeaderValues : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/email/FluentPartAssert::getHeaderValues → KILLED
		return null;
381
	}
382
}

Mutations

69

1.1
Location : contentAsString
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentAsString → TIMED_OUT

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

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

4.4
Location : contentAsString
Killed by : oghamall.it.email.EmailSMTPAuthenticationTest.authenticated(oghamall.it.email.EmailSMTPAuthenticationTest)
replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentAsString → KILLED

5.5
Location : contentAsString
Killed by : oghamjavamail.it.JavaMailSmtpTest.simple(oghamjavamail.it.JavaMailSmtpTest)
replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentAsString → KILLED

103

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

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

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

4.4
Location : contentAsString
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → KILLED

5.5
Location : lambda$contentAsString$0
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
negated conditional → KILLED

6.6
Location : lambda$contentAsString$0
Killed by : none
negated conditional → NO_COVERAGE

7.7
Location : lambda$contentAsString$0
Killed by : oghamall.it.configuration.EmptyBuilderTest.manualJavaMailConfigurationCanSendEmail(oghamall.it.configuration.EmptyBuilderTest)
negated conditional → KILLED

8.8
Location : lambda$contentAsString$0
Killed by : none
negated conditional → TIMED_OUT

9.9
Location : lambda$contentAsString$0
Killed by : oghamjavamail.it.JavaMailSmtpTest.simple(oghamjavamail.it.JavaMailSmtpTest)
negated conditional → KILLED

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

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

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

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

105

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

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

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

4.4
Location : contentAsString
Killed by : oghamall.it.email.EmailSMTPAuthenticationTest.authenticated(oghamall.it.email.EmailSMTPAuthenticationTest)
replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentAsString → KILLED

5.5
Location : contentAsString
Killed by : oghamjavamail.it.JavaMailSmtpTest.simple(oghamjavamail.it.JavaMailSmtpTest)
replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentAsString → KILLED

140

1.1
Location : content
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → KILLED

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

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

4.4
Location : lambda$content$1
Killed by : none
negated conditional → NO_COVERAGE

5.5
Location : lambda$content$1
Killed by : oghamjavamail.it.JavaMailSmtpTest.attachment(oghamjavamail.it.JavaMailSmtpTest)
negated conditional → KILLED

6.6
Location : lambda$content$1
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
negated conditional → KILLED

7.7
Location : lambda$content$1
Killed by : oghamall.it.email.EmailSMTPDefaultsTest.attachmentLookup(oghamall.it.email.EmailSMTPDefaultsTest)
negated conditional → KILLED

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

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

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

142

1.1
Location : content
Killed by : oghamall.it.email.EmailSMTPDefaultsTest.attachmentLookup(oghamall.it.email.EmailSMTPDefaultsTest)
replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::content → KILLED

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

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

4.4
Location : content
Killed by : oghamjavamail.it.JavaMailSmtpTest.attachment(oghamjavamail.it.JavaMailSmtpTest)
replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::content → KILLED

177

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

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

3.3
Location : contentType
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → KILLED

4.4
Location : lambda$contentType$2
Killed by : none
negated conditional → NO_COVERAGE

5.5
Location : lambda$contentType$2
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
negated conditional → KILLED

6.6
Location : lambda$contentType$2
Killed by : oghamall.it.email.EmailSMTPAuthenticationTest.authenticated(oghamall.it.email.EmailSMTPAuthenticationTest)
negated conditional → KILLED

7.7
Location : lambda$contentType$2
Killed by : oghamjavamail.it.JavaMailSmtpTest.simple(oghamjavamail.it.JavaMailSmtpTest)
negated conditional → KILLED

8.8
Location : lambda$contentType$2
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → NO_COVERAGE

9.9
Location : lambda$contentType$2
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → KILLED

10.10
Location : lambda$contentType$2
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → SURVIVED

179

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

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

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

4.4
Location : contentType
Killed by : oghamall.it.email.EmailSMTPAuthenticationTest.authenticated(oghamall.it.email.EmailSMTPAuthenticationTest)
replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::contentType → KILLED

214

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

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

3.3
Location : lambda$description$3
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
negated conditional → KILLED

4.4
Location : lambda$description$3
Killed by : none
negated conditional → NO_COVERAGE

5.5
Location : lambda$description$3
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → KILLED

6.6
Location : lambda$description$3
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → NO_COVERAGE

216

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

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

251

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

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

3.3
Location : disposition
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → KILLED

4.4
Location : lambda$disposition$4
Killed by : oghamjavamail.it.JavaMailSmtpTest.attachment(oghamjavamail.it.JavaMailSmtpTest)
negated conditional → KILLED

5.5
Location : lambda$disposition$4
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
negated conditional → KILLED

6.6
Location : lambda$disposition$4
Killed by : oghamall.it.email.EmailSMTPDefaultsTest.attachmentLookup(oghamall.it.email.EmailSMTPDefaultsTest)
negated conditional → KILLED

7.7
Location : lambda$disposition$4
Killed by : none
negated conditional → NO_COVERAGE

8.8
Location : lambda$disposition$4
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → NO_COVERAGE

9.9
Location : lambda$disposition$4
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → SURVIVED

10.10
Location : lambda$disposition$4
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → KILLED

253

1.1
Location : disposition
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::disposition → SURVIVED

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

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

4.4
Location : disposition
Killed by : oghamall.it.resolver.FreemarkerRelativeResourcesTests.relativeToPrefixSuffixAndPath(oghamall.it.resolver.FreemarkerRelativeResourcesTests)
replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::disposition → KILLED

288

1.1
Location : filename
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
removed call to fr/sii/ogham/testing/assertion/util/AssertionRegistry::register → KILLED

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

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

4.4
Location : lambda$filename$5
Killed by : oghamall.it.email.EmailSMTPDefaultsTest.attachmentLookup(oghamall.it.email.EmailSMTPDefaultsTest)
negated conditional → KILLED

5.5
Location : lambda$filename$5
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
negated conditional → KILLED

6.6
Location : lambda$filename$5
Killed by : oghamjavamail.it.JavaMailSmtpTest.attachment(oghamjavamail.it.JavaMailSmtpTest)
negated conditional → KILLED

7.7
Location : lambda$filename$5
Killed by : none
negated conditional → NO_COVERAGE

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

9.9
Location : lambda$filename$5
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → NO_COVERAGE

10.10
Location : lambda$filename$5
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → SURVIVED

290

1.1
Location : filename
Killed by : oghamall.it.email.EmailSMTPDefaultsTest.attachmentLookup(oghamall.it.email.EmailSMTPDefaultsTest)
replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::filename → KILLED

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

3.3
Location : filename
Killed by : oghamjavamail.it.JavaMailSmtpTest.attachment(oghamjavamail.it.JavaMailSmtpTest)
replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::filename → KILLED

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

325

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

2.2
Location : lambda$headers$6
Killed by : none
negated conditional → NO_COVERAGE

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

327

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

364

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

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

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

4.4
Location : lambda$header$7
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → KILLED

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

6.6
Location : lambda$header$7
Killed by : none
removed call to fr/sii/ogham/testing/assertion/util/AssertionHelper::assertThat → SURVIVED

366

1.1
Location : header
Killed by : oghamall.it.email.FluentEmailTest.embedStream(oghamall.it.email.FluentEmailTest)
replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::header → KILLED

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

3.3
Location : header
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/email/FluentPartAssert::header → SURVIVED

374

1.1
Location : getHeaderValues
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
negated conditional → KILLED

2.2
Location : getHeaderValues
Killed by : oghamall.it.email.FluentEmailTest.embedStream(oghamall.it.email.FluentEmailTest)
negated conditional → KILLED

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

376

1.1
Location : getHeaderValues
Killed by : oghamall.it.email.FluentEmailTest.embedStream(oghamall.it.email.FluentEmailTest)
negated conditional → KILLED

2.2
Location : getHeaderValues
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
negated conditional → KILLED

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

377

1.1
Location : getHeaderValues
Killed by : oghamall.it.email.FluentEmailTest.embedStream(oghamall.it.email.FluentEmailTest)
replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/email/FluentPartAssert::getHeaderValues → KILLED

2.2
Location : getHeaderValues
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/email/FluentPartAssert::getHeaderValues → KILLED

3.3
Location : getHeaderValues
Killed by : none
replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/email/FluentPartAssert::getHeaderValues → NO_COVERAGE

380

1.1
Location : getHeaderValues
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/email/FluentPartAssert::getHeaderValues → KILLED

2.2
Location : getHeaderValues
Killed by : none
replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/email/FluentPartAssert::getHeaderValues → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT OGHAM