EmailUtils.java

1
package fr.sii.ogham.testing.assertion.util;
2
3
import java.io.ByteArrayOutputStream;
4
import java.io.IOException;
5
import java.io.InputStream;
6
import java.nio.charset.Charset;
7
import java.util.ArrayList;
8
import java.util.List;
9
import java.util.function.Predicate;
10
11
import ogham.testing.jakarta.mail.BodyPart;
12
import ogham.testing.jakarta.mail.Message;
13
import ogham.testing.jakarta.mail.MessagingException;
14
import ogham.testing.jakarta.mail.Multipart;
15
import ogham.testing.jakarta.mail.Part;
16
import ogham.testing.jakarta.mail.internet.MimeMessage;
17
18
import ogham.testing.org.apache.commons.io.IOUtils;
19
import org.slf4j.Logger;
20
import org.slf4j.LoggerFactory;
21
22
import fr.sii.ogham.testing.assertion.filter.DefaultAttachmentPredicate;
23
import fr.sii.ogham.testing.assertion.filter.FileNamePredicate;
24
25
public final class EmailUtils {
26
	private static final Logger LOG = LoggerFactory.getLogger(EmailUtils.class);
27
	public static final String ATTACHMENT_DISPOSITION = "attachment";
28
	public static final String INLINE_DISPOSITION = "inline";
29
	
30
	/**
31
	 * Retrieve the body parts of the message (recursively):
32
	 * <ul>
33
	 * <li>The part of the message when it contains only one part</li>
34
	 * <li>The parts with text/* mimetype</li>
35
	 * </ul>
36
	 * 
37
	 * @param actualEmail
38
	 *            the message
39
	 * @return the body of the message
40
	 * @throws MessagingException
41
	 *             when message can't be read
42
	 */
43
	public static List<Part> getBodyParts(Part actualEmail) throws MessagingException {
44 1 1. getBodyParts : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/util/EmailUtils::getBodyParts → NO_COVERAGE
		return getTextualParts(actualEmail);
45
	}
46
47
	/**
48
	 * Retrieve the main part of the message (recursively):
49
	 * <ul>
50
	 * <li>The part of the message when it contains only one part</li>
51
	 * <li>The part with text/* mimetype if only one part with one of that
52
	 * mimetype</li>
53
	 * <li>The last part with text or HTML mimetype if there are several text/*
54
	 * parts</li>
55
	 * </ul>
56
	 * 
57
	 * @param actualEmail
58
	 *            the message
59
	 * @return the body of the message
60
	 * @throws MessagingException
61
	 *             when message can't be read
62
	 */
63
	public static Part getBodyPart(Part actualEmail) throws MessagingException {
64 1 1. getBodyPart : replaced return value with null for fr/sii/ogham/testing/assertion/util/EmailUtils::getBodyPart → NO_COVERAGE
		return getBestAlternative(getBodyParts(actualEmail));
65
	}
66
67
	/**
68
	 * Retrieve the alternative part of the message (recursively). The
69
	 * alternative is useful when sending HTML email that may be unreadable on
70
	 * some email clients. For example, a smartphone will display the 2 or 3
71
	 * first lines as a summary. Many smartphones will take the HTML message
72
	 * as-is and will display HTML tags instead of content of email. Alternative
73
	 * is used to provide a textual visualization of the message that will be
74
	 * readable by any system.
75
	 * 
76
	 * <p>
77
	 * The alternative of the message is either:
78
	 * <ul>
79
	 * <li>null if there is only one part</li>
80
	 * <li>null if there is only one text or HTML part</li>
81
	 * <li>the first part if there are more than one text or HTML part</li>
82
	 * </ul>
83
	 * 
84
	 * @param actualEmail
85
	 *            the message
86
	 * @return the alternative part of the message if exists, null otherwise
87
	 * @throws MessagingException
88
	 *             when message can't be read
89
	 */
90
	public static Part getAlternativePart(Part actualEmail) throws MessagingException {
91
		List<Part> bodyParts = getTextualParts(actualEmail);
92 2 1. getAlternativePart : negated conditional → NO_COVERAGE
2. getAlternativePart : changed conditional boundary → NO_COVERAGE
		if (bodyParts.size() < 2) {
93
			return null;
94
		}
95 1 1. getAlternativePart : replaced return value with null for fr/sii/ogham/testing/assertion/util/EmailUtils::getAlternativePart → NO_COVERAGE
		return bodyParts.get(0);
96
	}
97
98
	/**
99
	 * Get the whole list of "textual" parts (text or HTML mimetypes).
100
	 * 
101
	 * @param actualEmail
102
	 *            the message
103
	 * @return the list of "textual" parts
104
	 * @throws MessagingException
105
	 *             when message can't be read
106
	 */
107
	public static List<Part> getTextualParts(Part actualEmail) throws MessagingException {
108 1 1. getTextualParts : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/util/EmailUtils::getTextualParts → NO_COVERAGE
		return getBodyParts(actualEmail, EmailUtils::isTextualContent);
109
	}
110
111
	/**
112
	 * Get the content as byte array of a particular part.
113
	 * 
114
	 * <p>
115
	 * If the part is null or the content stream is null, then
116
	 * null is returned.
117
	 * 
118
	 * @param part
119
	 *            the part
120
	 * @return the content as byte array or null
121
	 * @throws IOException
122
	 *             when part can't be read
123
	 * @throws MessagingException
124
	 *             when message can't be read
125
	 */
126
	@SuppressWarnings("squid:S1168")	// return null on purpose (to be able to distinguish empty content from no content at all in tests)
127
	public static byte[] getContent(Part part) throws IOException, MessagingException {
128 1 1. getContent : negated conditional → NO_COVERAGE
		if (part == null) {
129
			return null;
130
		}
131
		InputStream stream = part.getInputStream();
132 1 1. getContent : negated conditional → NO_COVERAGE
		if (stream == null) {
133
			return null;
134
		}
135
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
136
		IOUtils.copy(stream, baos);
137 1 1. getContent : replaced return value with null for fr/sii/ogham/testing/assertion/util/EmailUtils::getContent → NO_COVERAGE
		return baos.toByteArray();
138
	}
139
140
	/**
141
	 * Get the content as {@link String} of a particular part.
142
	 * 
143
	 * <p>
144
	 * <strong>NOTE: This method handles a special case due to how Java Mail
145
	 * sends textual content (adds CRLF)</strong> If the content is a textual
146
	 * content ("text/*" mimetype) and the part has no parent and it ends with
147
	 * CRLF, remove the last CRLF.
148
	 * 
149
	 * <strong>If your original text had the CRLF, this method can't know that
150
	 * it was already part of the original text because Java Mail only adds CRLF
151
	 * if there not already has CRLF at the end of the text.</strong>
152
	 * 
153
	 * <p>
154
	 * If the part is null or the content stream is null, then
155
	 * null is returned.
156
	 * 
157
	 * @param part
158
	 *            the part
159
	 * @param charset
160
	 *            the charset used to decode the part content
161
	 * @return the part content
162
	 * @throws MessagingException
163
	 *             when the part can't be accessed
164
	 * @throws IOException
165
	 *             when the part content can't be read
166
	 */
167
	public static String getContent(Part part, Charset charset) throws IOException, MessagingException {
168
		byte[] bytes = getContent(part);
169 1 1. getContent : negated conditional → NO_COVERAGE
		if (bytes == null) {
170 1 1. getContent : replaced return value with "" for fr/sii/ogham/testing/assertion/util/EmailUtils::getContent → NO_COVERAGE
			return null;
171
		}
172
		String content = IOUtils.toString(bytes, charset.name());
173 3 1. getContent : negated conditional → NO_COVERAGE
2. getContent : negated conditional → NO_COVERAGE
3. getContent : negated conditional → NO_COVERAGE
		if (isTextualContent(part) && !hasParent(part) && content.endsWith("\r\n")) {
174 2 1. getContent : replaced return value with "" for fr/sii/ogham/testing/assertion/util/EmailUtils::getContent → NO_COVERAGE
2. getContent : Replaced integer subtraction with addition → NO_COVERAGE
			return content.substring(0, content.length() - 2);
175
		}
176 1 1. getContent : replaced return value with "" for fr/sii/ogham/testing/assertion/util/EmailUtils::getContent → NO_COVERAGE
		return content;
177
	}
178
179
	/**
180
	 * Get a particular attachment (found using exact filename field).
181
	 * 
182
	 * @param multipart
183
	 *            the email that contains several parts
184
	 * @param filename
185
	 *            the name of the attachment to find
186
	 * @return the found attachment or null
187
	 * @throws MessagingException
188
	 *             when message can't be read
189
	 */
190
	public static BodyPart getAttachment(Multipart multipart, final String filename) throws MessagingException {
191 1 1. getAttachment : replaced return value with null for fr/sii/ogham/testing/assertion/util/EmailUtils::getAttachment → NO_COVERAGE
		return getAttachment(multipart, new FileNamePredicate(filename));
192
	}
193
194
	/**
195
	 * Get a particular attachment (found using provided predicate). If several
196
	 * attachments match the predicate, only the first one is retrieved.
197
	 * 
198
	 * @param multipart
199
	 *            the email that contains several parts
200
	 * @param filter
201
	 *            the predicate used to find the attachment
202
	 * @return the found attachment or null
203
	 * @throws MessagingException
204
	 *             when message can't be read
205
	 */
206
	public static BodyPart getAttachment(Multipart multipart, Predicate<Part> filter) throws MessagingException {
207
		List<BodyPart> attachments = getAttachments(multipart, filter);
208 2 1. getAttachment : replaced return value with null for fr/sii/ogham/testing/assertion/util/EmailUtils::getAttachment → NO_COVERAGE
2. getAttachment : negated conditional → NO_COVERAGE
		return attachments.isEmpty() ? null : attachments.get(0);
209
	}
210
211
	/**
212
	 * Get a list of direct attachments that match the provided predicate.
213
	 * 
214
	 * @param multipart
215
	 *            the email that contains several parts
216
	 * @param filter
217
	 *            the predicate used to find the attachments
218
	 * @return the found attachments or empty list
219
	 * @throws MessagingException
220
	 *             when message can't be read
221
	 */
222
	public static List<BodyPart> getAttachments(Multipart multipart, Predicate<Part> filter) throws MessagingException {
223 1 1. getAttachments : negated conditional → NO_COVERAGE
		if (multipart == null) {
224
			throw new IllegalStateException("The multipart can't be null");
225
		}
226
		List<BodyPart> found = new ArrayList<>();
227 2 1. getAttachments : negated conditional → NO_COVERAGE
2. getAttachments : changed conditional boundary → NO_COVERAGE
		for (int i = 0; i < multipart.getCount(); i++) {
228
			BodyPart bodyPart = multipart.getBodyPart(i);
229 1 1. getAttachments : negated conditional → NO_COVERAGE
			if (filter.test(bodyPart)) {
230
				found.add(bodyPart);
231
			}
232
		}
233 1 1. getAttachments : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/util/EmailUtils::getAttachments → NO_COVERAGE
		return found;
234
	}
235
236
	/**
237
	 * Get the whole list of attachments (recursively).
238
	 * 
239
	 * @param message
240
	 *            the email that contains several parts
241
	 * @return the found attachments or empty list
242
	 * @throws MessagingException
243
	 *             when message can't be read
244
	 */
245
	public static List<BodyPart> getAttachments(Part message) throws MessagingException {
246 2 1. getAttachments : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/util/EmailUtils::getAttachments → NO_COVERAGE
2. lambda$getAttachments$0 : replaced boolean return with false for fr/sii/ogham/testing/assertion/util/EmailUtils::lambda$getAttachments$0 → NO_COVERAGE
		return getAttachments(message, p -> true);
247
	}
248
249
	/**
250
	 * Get the whole list of attachments.
251
	 * 
252
	 * <p>
253
	 * <strong>WARNING:</strong> As there is no way to ensure that a part is an
254
	 * attachment, every part is testing against the filter (event multipart
255
	 * containers). So the filter that you provide is combined with
256
	 * {@link DefaultAttachmentPredicate}. This way, only the list of parts that
257
	 * may be potential attachments (downloadable or embeddable) are provided to
258
	 * your filter.
259
	 * 
260
	 * @param message
261
	 *            the email that contains several parts
262
	 * @param filter
263
	 *            filter the parts to keep only some attachments. If filter
264
	 *            returns true then the part is added to the list.
265
	 * @param <T>
266
	 *            type of part
267
	 * @return the found attachments or empty list
268
	 * @throws MessagingException
269
	 *             when message can't be read
270
	 */
271
	public static <T extends Part> List<T> getAttachments(Part message, Predicate<Part> filter) throws MessagingException {
272
		List<T> attachments = new ArrayList<>();
273 1 1. getAttachments : removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::findBodyParts → NO_COVERAGE
		findBodyParts(message, new DefaultAttachmentPredicate().and(filter), attachments);
274 1 1. getAttachments : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/util/EmailUtils::getAttachments → NO_COVERAGE
		return attachments;
275
	}
276
277
	/**
278
	 * Indicates if a part is a multipart (its Content-Type starts with
279
	 * "multipart/").
280
	 * 
281
	 * @param part
282
	 *            the part to check
283
	 * @return true if a multipart
284
	 */
285
	public static boolean isMultipart(Part part) {
286
		try {
287 2 1. isMultipart : replaced boolean return with true for fr/sii/ogham/testing/assertion/util/EmailUtils::isMultipart → NO_COVERAGE
2. isMultipart : replaced boolean return with false for fr/sii/ogham/testing/assertion/util/EmailUtils::isMultipart → NO_COVERAGE
			return part.isMimeType("multipart/*");
288
		} catch (MessagingException e) {
289
			throw new MessagingRuntimeException("Failed to retrieve Content-Type of part", e);
290
		}
291
	}
292
293
	/**
294
	 * Indicates if the part contains text (either plain text or html). It is
295
	 * checked using Content-Type (either "text/*", "application/html" or
296
	 * "application/xhtml").
297
	 * 
298
	 * @param part
299
	 *            the part to check
300
	 * @return true if it is text
301
	 */
302
	public static boolean isTextualContent(Part part) {
303
		try {
304 4 1. isTextualContent : negated conditional → NO_COVERAGE
2. isTextualContent : replaced boolean return with true for fr/sii/ogham/testing/assertion/util/EmailUtils::isTextualContent → NO_COVERAGE
3. isTextualContent : negated conditional → NO_COVERAGE
4. isTextualContent : negated conditional → NO_COVERAGE
			return part.isMimeType("text/*") || part.isMimeType("application/html") || part.isMimeType("application/xhtml");
305
		} catch (MessagingException e) {
306
			throw new MessagingRuntimeException("Failed to retrieve Content-Type of part", e);
307
		}
308
	}
309
310
	/**
311
	 * Get the whole structure of the email. This is mainly used for debugging
312
	 * purpose.
313
	 * 
314
	 * @param mimeMessage
315
	 *            the email
316
	 * @return the structure of the email
317
	 * @throws IOException
318
	 *             when email can't be read
319
	 * @throws MessagingException
320
	 *             when email can't be read
321
	 */
322
	public static String getStructure(MimeMessage mimeMessage) throws IOException, MessagingException {
323
		StringBuilder structure = new StringBuilder();
324 1 1. getStructure : removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::findParts → NO_COVERAGE
		findParts(mimeMessage, structure, "");
325 1 1. getStructure : replaced return value with "" for fr/sii/ogham/testing/assertion/util/EmailUtils::getStructure → NO_COVERAGE
		return structure.toString();
326
	}
327
328
	/**
329
	 * Get the partial structure of the email from the provided container. This
330
	 * is mainly used for debugging purpose.
331
	 * 
332
	 * @param multipart
333
	 *            the container
334
	 * @return the structure of the email
335
	 * @throws IOException
336
	 *             when email can't be read
337
	 * @throws MessagingException
338
	 *             when email can't be read
339
	 */
340
	public static String getStructure(Multipart multipart) throws IOException, MessagingException {
341
		StringBuilder structure = new StringBuilder();
342 1 1. getStructure : removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::findParts → NO_COVERAGE
		findParts(multipart, structure, "");
343 1 1. getStructure : replaced return value with "" for fr/sii/ogham/testing/assertion/util/EmailUtils::getStructure → NO_COVERAGE
		return structure.toString();
344
	}
345
346
	/**
347
	 * Get the partial structure of the email from the provided part. This is
348
	 * mainly used for debugging purpose.
349
	 * 
350
	 * @param part
351
	 *            the part
352
	 * @return the structure of the email
353
	 * @throws IOException
354
	 *             when email can't be read
355
	 * @throws MessagingException
356
	 *             when email can't be read
357
	 */
358
	public static String getStructure(BodyPart part) throws IOException, MessagingException {
359
		StringBuilder structure = new StringBuilder();
360 1 1. getStructure : removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::findParts → NO_COVERAGE
		findParts(part, structure, "");
361 1 1. getStructure : replaced return value with "" for fr/sii/ogham/testing/assertion/util/EmailUtils::getStructure → NO_COVERAGE
		return structure.toString();
362
	}
363
364
	private static <T extends Part> List<T> getBodyParts(Part actualEmail, Predicate<Part> filter) throws MessagingException {
365
		List<T> founds = new ArrayList<>();
366 1 1. getBodyParts : removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::findBodyParts → NO_COVERAGE
		findBodyParts(actualEmail, filter, founds);
367 1 1. getBodyParts : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/util/EmailUtils::getBodyParts → NO_COVERAGE
		return founds;
368
	}
369
370
	private static <T extends Part> void findBodyParts(Part actualEmail, Predicate<Part> filter, List<T> founds) throws MessagingException {
371
		LOG.trace("---------------------------");
372 1 1. findBodyParts : removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::findBodyParts → NO_COVERAGE
		findBodyParts(actualEmail, filter, founds, "");
373
	}
374
375
	private static <T extends Part> void findBodyParts(Part part, Predicate<Part> filter, List<T> founds, String indent) throws MessagingException {
376
		try {
377 1 1. findBodyParts : removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::addPart → NO_COVERAGE
			addPart(filter, founds, indent, part);
378
			Object content = part.getContent();
379 1 1. findBodyParts : negated conditional → NO_COVERAGE
			if (content instanceof Multipart) {
380
				Multipart mp = (Multipart) content;
381
				LOG.trace("{}find {}", indent, mp.getContentType());
382 2 1. findBodyParts : negated conditional → NO_COVERAGE
2. findBodyParts : changed conditional boundary → NO_COVERAGE
				for (int i = 0; i < mp.getCount(); i++) {
383 1 1. findBodyParts : removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::findBodyParts → NO_COVERAGE
					findBodyParts(mp.getBodyPart(i), filter, founds, indent + "   ");
384
				}
385
			}
386
		} catch (IOException e) {
387
			throw new MessagingException("Failed to access content of the mail", e);
388
		}
389
	}
390
391
	@SuppressWarnings("unchecked")
392
	private static <T extends Part> void addPart(Predicate<Part> filter, List<T> founds, String indent, Part part) throws MessagingException {
393 1 1. addPart : negated conditional → NO_COVERAGE
		if (filter.test(part)) {
394
			LOG.trace("{}{}add {}", indent, "   ", part.getContentType());
395
			founds.add((T) part);
396
		}
397
	}
398
399
	private static void findParts(Part part, StringBuilder structure, String indent) throws IOException, MessagingException {
400 1 1. findParts : removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::addPart → NO_COVERAGE
		addPart(part, structure, indent);
401
		Object content = part.getContent();
402 1 1. findParts : negated conditional → NO_COVERAGE
		if (content instanceof Multipart) {
403 1 1. findParts : removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::findParts → NO_COVERAGE
			findParts((Multipart) content, structure, indent);
404
		}
405
	}
406
407
	private static void findParts(Multipart mp, StringBuilder structure, String indent) throws MessagingException, IOException {
408 2 1. findParts : negated conditional → NO_COVERAGE
2. findParts : changed conditional boundary → NO_COVERAGE
		for (int i = 0; i < mp.getCount(); i++) {
409
			BodyPart subpart = mp.getBodyPart(i);
410 1 1. findParts : removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::findParts → NO_COVERAGE
			findParts(subpart, structure, indent + "  ");
411
		}
412
	}
413
414
	private static void addPart(Part part, StringBuilder structure, String indent) throws MessagingException {
415
		structure.append(indent).append("[").append(part.getDataHandler().getContentType().split(";")[0]).append("]\n");
416
	}
417
418
	/**
419
	 * According to
420
	 * <a href="https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html">rfc1341
421
	 * §7.2.3 The Multipart/alternative subtype</a>, the best alternative is the
422
	 * last that can be displayed.
423
	 * 
424
	 * @param bodyParts
425
	 *            the possible body parts
426
	 * @return
427
	 */
428
	private static Part getBestAlternative(List<Part> bodyParts) {
429 1 1. getBestAlternative : negated conditional → NO_COVERAGE
		if (bodyParts.isEmpty()) {
430
			return null;
431
		}
432 2 1. getBestAlternative : Replaced integer subtraction with addition → NO_COVERAGE
2. getBestAlternative : replaced return value with null for fr/sii/ogham/testing/assertion/util/EmailUtils::getBestAlternative → NO_COVERAGE
		return bodyParts.get(bodyParts.size() - 1);
433
	}
434
435
	private static boolean hasParent(Part part) {
436 1 1. hasParent : negated conditional → NO_COVERAGE
		if (part instanceof Message) {
437 1 1. hasParent : replaced boolean return with true for fr/sii/ogham/testing/assertion/util/EmailUtils::hasParent → NO_COVERAGE
			return false;
438
		}
439 1 1. hasParent : negated conditional → NO_COVERAGE
		if (part instanceof BodyPart) {
440 2 1. hasParent : replaced boolean return with true for fr/sii/ogham/testing/assertion/util/EmailUtils::hasParent → NO_COVERAGE
2. hasParent : negated conditional → NO_COVERAGE
			return ((BodyPart) part).getParent() != null;
441
		}
442 1 1. hasParent : replaced boolean return with true for fr/sii/ogham/testing/assertion/util/EmailUtils::hasParent → NO_COVERAGE
		return false;
443
	}
444
445
	private EmailUtils() {
446
		super();
447
	}
448
449
	private static class MessagingRuntimeException extends RuntimeException {
450
		private static final long serialVersionUID = 1L;
451
452
		public MessagingRuntimeException(String message, Throwable cause) {
453
			super(message, cause);
454
		}
455
	}
456
}

Mutations

44

1.1
Location : getBodyParts
Killed by :
replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/util/EmailUtils::getBodyParts → NO_COVERAGE

64

1.1
Location : getBodyPart
Killed by :
replaced return value with null for fr/sii/ogham/testing/assertion/util/EmailUtils::getBodyPart → NO_COVERAGE

92

1.1
Location : getAlternativePart
Killed by :
negated conditional → NO_COVERAGE

2.2
Location : getAlternativePart
Killed by :
changed conditional boundary → NO_COVERAGE

95

1.1
Location : getAlternativePart
Killed by :
replaced return value with null for fr/sii/ogham/testing/assertion/util/EmailUtils::getAlternativePart → NO_COVERAGE

108

1.1
Location : getTextualParts
Killed by :
replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/util/EmailUtils::getTextualParts → NO_COVERAGE

128

1.1
Location : getContent
Killed by :
negated conditional → NO_COVERAGE

132

1.1
Location : getContent
Killed by :
negated conditional → NO_COVERAGE

137

1.1
Location : getContent
Killed by :
replaced return value with null for fr/sii/ogham/testing/assertion/util/EmailUtils::getContent → NO_COVERAGE

169

1.1
Location : getContent
Killed by :
negated conditional → NO_COVERAGE

170

1.1
Location : getContent
Killed by :
replaced return value with "" for fr/sii/ogham/testing/assertion/util/EmailUtils::getContent → NO_COVERAGE

173

1.1
Location : getContent
Killed by :
negated conditional → NO_COVERAGE

2.2
Location : getContent
Killed by :
negated conditional → NO_COVERAGE

3.3
Location : getContent
Killed by :
negated conditional → NO_COVERAGE

174

1.1
Location : getContent
Killed by :
replaced return value with "" for fr/sii/ogham/testing/assertion/util/EmailUtils::getContent → NO_COVERAGE

2.2
Location : getContent
Killed by :
Replaced integer subtraction with addition → NO_COVERAGE

176

1.1
Location : getContent
Killed by :
replaced return value with "" for fr/sii/ogham/testing/assertion/util/EmailUtils::getContent → NO_COVERAGE

191

1.1
Location : getAttachment
Killed by :
replaced return value with null for fr/sii/ogham/testing/assertion/util/EmailUtils::getAttachment → NO_COVERAGE

208

1.1
Location : getAttachment
Killed by :
replaced return value with null for fr/sii/ogham/testing/assertion/util/EmailUtils::getAttachment → NO_COVERAGE

2.2
Location : getAttachment
Killed by :
negated conditional → NO_COVERAGE

223

1.1
Location : getAttachments
Killed by :
negated conditional → NO_COVERAGE

227

1.1
Location : getAttachments
Killed by :
negated conditional → NO_COVERAGE

2.2
Location : getAttachments
Killed by :
changed conditional boundary → NO_COVERAGE

229

1.1
Location : getAttachments
Killed by :
negated conditional → NO_COVERAGE

233

1.1
Location : getAttachments
Killed by :
replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/util/EmailUtils::getAttachments → NO_COVERAGE

246

1.1
Location : getAttachments
Killed by :
replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/util/EmailUtils::getAttachments → NO_COVERAGE

2.2
Location : lambda$getAttachments$0
Killed by :
replaced boolean return with false for fr/sii/ogham/testing/assertion/util/EmailUtils::lambda$getAttachments$0 → NO_COVERAGE

273

1.1
Location : getAttachments
Killed by :
removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::findBodyParts → NO_COVERAGE

274

1.1
Location : getAttachments
Killed by :
replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/util/EmailUtils::getAttachments → NO_COVERAGE

287

1.1
Location : isMultipart
Killed by :
replaced boolean return with true for fr/sii/ogham/testing/assertion/util/EmailUtils::isMultipart → NO_COVERAGE

2.2
Location : isMultipart
Killed by :
replaced boolean return with false for fr/sii/ogham/testing/assertion/util/EmailUtils::isMultipart → NO_COVERAGE

304

1.1
Location : isTextualContent
Killed by :
negated conditional → NO_COVERAGE

2.2
Location : isTextualContent
Killed by :
replaced boolean return with true for fr/sii/ogham/testing/assertion/util/EmailUtils::isTextualContent → NO_COVERAGE

3.3
Location : isTextualContent
Killed by :
negated conditional → NO_COVERAGE

4.4
Location : isTextualContent
Killed by :
negated conditional → NO_COVERAGE

324

1.1
Location : getStructure
Killed by :
removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::findParts → NO_COVERAGE

325

1.1
Location : getStructure
Killed by :
replaced return value with "" for fr/sii/ogham/testing/assertion/util/EmailUtils::getStructure → NO_COVERAGE

342

1.1
Location : getStructure
Killed by :
removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::findParts → NO_COVERAGE

343

1.1
Location : getStructure
Killed by :
replaced return value with "" for fr/sii/ogham/testing/assertion/util/EmailUtils::getStructure → NO_COVERAGE

360

1.1
Location : getStructure
Killed by :
removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::findParts → NO_COVERAGE

361

1.1
Location : getStructure
Killed by :
replaced return value with "" for fr/sii/ogham/testing/assertion/util/EmailUtils::getStructure → NO_COVERAGE

366

1.1
Location : getBodyParts
Killed by :
removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::findBodyParts → NO_COVERAGE

367

1.1
Location : getBodyParts
Killed by :
replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/util/EmailUtils::getBodyParts → NO_COVERAGE

372

1.1
Location : findBodyParts
Killed by :
removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::findBodyParts → NO_COVERAGE

377

1.1
Location : findBodyParts
Killed by :
removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::addPart → NO_COVERAGE

379

1.1
Location : findBodyParts
Killed by :
negated conditional → NO_COVERAGE

382

1.1
Location : findBodyParts
Killed by :
negated conditional → NO_COVERAGE

2.2
Location : findBodyParts
Killed by :
changed conditional boundary → NO_COVERAGE

383

1.1
Location : findBodyParts
Killed by :
removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::findBodyParts → NO_COVERAGE

393

1.1
Location : addPart
Killed by :
negated conditional → NO_COVERAGE

400

1.1
Location : findParts
Killed by :
removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::addPart → NO_COVERAGE

402

1.1
Location : findParts
Killed by :
negated conditional → NO_COVERAGE

403

1.1
Location : findParts
Killed by :
removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::findParts → NO_COVERAGE

408

1.1
Location : findParts
Killed by :
negated conditional → NO_COVERAGE

2.2
Location : findParts
Killed by :
changed conditional boundary → NO_COVERAGE

410

1.1
Location : findParts
Killed by :
removed call to fr/sii/ogham/testing/assertion/util/EmailUtils::findParts → NO_COVERAGE

429

1.1
Location : getBestAlternative
Killed by :
negated conditional → NO_COVERAGE

432

1.1
Location : getBestAlternative
Killed by :
Replaced integer subtraction with addition → NO_COVERAGE

2.2
Location : getBestAlternative
Killed by :
replaced return value with null for fr/sii/ogham/testing/assertion/util/EmailUtils::getBestAlternative → NO_COVERAGE

436

1.1
Location : hasParent
Killed by :
negated conditional → NO_COVERAGE

437

1.1
Location : hasParent
Killed by :
replaced boolean return with true for fr/sii/ogham/testing/assertion/util/EmailUtils::hasParent → NO_COVERAGE

439

1.1
Location : hasParent
Killed by :
negated conditional → NO_COVERAGE

440

1.1
Location : hasParent
Killed by :
replaced boolean return with true for fr/sii/ogham/testing/assertion/util/EmailUtils::hasParent → NO_COVERAGE

2.2
Location : hasParent
Killed by :
negated conditional → NO_COVERAGE

442

1.1
Location : hasParent
Killed by :
replaced boolean return with true for fr/sii/ogham/testing/assertion/util/EmailUtils::hasParent → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.13.1