EveryImageInliner.java

1
package fr.sii.ogham.html.inliner;
2
3
import java.util.ArrayList;
4
import java.util.Arrays;
5
import java.util.List;
6
7
/**
8
 * Applies in sequence all provided decorated inliners. This may be useful to
9
 * allow several strategies to be applied on the same message content according
10
 * to the images.
11
 * 
12
 * @author Aurélien Baudet
13
 *
14
 */
15
public class EveryImageInliner implements ImageInliner {
16
	/**
17
	 * The list of inliners to apply in sequence
18
	 */
19
	private List<ImageInliner> inliners;
20
21
	public EveryImageInliner(ImageInliner... inliners) {
22
		this(new ArrayList<>(Arrays.asList(inliners)));
23
	}
24
25
	public EveryImageInliner(List<ImageInliner> inliners) {
26
		super();
27
		this.inliners = inliners;
28
	}
29
30
	@Override
31
	public ContentWithImages inline(String htmlContent, List<ImageResource> images) {
32
		ContentWithImages combined = new ContentWithImages(htmlContent);
33
		for (ImageInliner inliner : inliners) {
34
			ContentWithImages partial = inliner.inline(combined.getContent(), images);
35 3 1. inline : removed call to fr/sii/ogham/html/inliner/ContentWithImages::setContent → NO_COVERAGE
2. inline : removed call to fr/sii/ogham/html/inliner/ContentWithImages::setContent → KILLED
3. inline : removed call to fr/sii/ogham/html/inliner/ContentWithImages::setContent → KILLED
			combined.setContent(partial.getContent());
36 3 1. inline : removed call to fr/sii/ogham/html/inliner/ContentWithImages::addAttachments → SURVIVED
2. inline : removed call to fr/sii/ogham/html/inliner/ContentWithImages::addAttachments → NO_COVERAGE
3. inline : removed call to fr/sii/ogham/html/inliner/ContentWithImages::addAttachments → KILLED
			combined.addAttachments(partial.getAttachments());
37
		}
38 3 1. inline : replaced return value with null for fr/sii/ogham/html/inliner/EveryImageInliner::inline → NO_COVERAGE
2. inline : replaced return value with null for fr/sii/ogham/html/inliner/EveryImageInliner::inline → KILLED
3. inline : replaced return value with null for fr/sii/ogham/html/inliner/EveryImageInliner::inline → KILLED
		return combined;
39
	}
40
41
	public EveryImageInliner addInliner(ImageInliner inliner) {
42
		inliners.add(inliner);
43 3 1. addInliner : replaced return value with null for fr/sii/ogham/html/inliner/EveryImageInliner::addInliner → NO_COVERAGE
2. addInliner : replaced return value with null for fr/sii/ogham/html/inliner/EveryImageInliner::addInliner → SURVIVED
3. addInliner : replaced return value with null for fr/sii/ogham/html/inliner/EveryImageInliner::addInliner → TIMED_OUT
		return this;
44
	}
45
}

Mutations

35

1.1
Location : inline
Killed by : oghamcore.it.html.translator.InlineImageTranslatorTest.oghamAttributesShoulBeRemoved(oghamcore.it.html.translator.InlineImageTranslatorTest)
removed call to fr/sii/ogham/html/inliner/ContentWithImages::setContent → KILLED

2.2
Location : inline
Killed by : oghamall.it.html.translator.JsoupInlineImageTranslatorTest.skipExternalImages(oghamall.it.html.translator.JsoupInlineImageTranslatorTest)
removed call to fr/sii/ogham/html/inliner/ContentWithImages::setContent → KILLED

3.3
Location : inline
Killed by : none
removed call to fr/sii/ogham/html/inliner/ContentWithImages::setContent → NO_COVERAGE

36

1.1
Location : inline
Killed by : oghamall.it.html.translator.JsoupInlineImageTranslatorTest.skipExternalImages(oghamall.it.html.translator.JsoupInlineImageTranslatorTest)
removed call to fr/sii/ogham/html/inliner/ContentWithImages::addAttachments → KILLED

2.2
Location : inline
Killed by : none
removed call to fr/sii/ogham/html/inliner/ContentWithImages::addAttachments → SURVIVED

3.3
Location : inline
Killed by : none
removed call to fr/sii/ogham/html/inliner/ContentWithImages::addAttachments → NO_COVERAGE

38

1.1
Location : inline
Killed by : none
replaced return value with null for fr/sii/ogham/html/inliner/EveryImageInliner::inline → NO_COVERAGE

2.2
Location : inline
Killed by : oghamcore.it.html.translator.InlineImageTranslatorTest.oghamAttributesShoulBeRemoved(oghamcore.it.html.translator.InlineImageTranslatorTest)
replaced return value with null for fr/sii/ogham/html/inliner/EveryImageInliner::inline → KILLED

3.3
Location : inline
Killed by : oghamall.it.html.translator.JsoupInlineImageTranslatorTest.skipExternalImages(oghamall.it.html.translator.JsoupInlineImageTranslatorTest)
replaced return value with null for fr/sii/ogham/html/inliner/EveryImageInliner::inline → KILLED

43

1.1
Location : addInliner
Killed by : none
replaced return value with null for fr/sii/ogham/html/inliner/EveryImageInliner::addInliner → NO_COVERAGE

2.2
Location : addInliner
Killed by : none
replaced return value with null for fr/sii/ogham/html/inliner/EveryImageInliner::addInliner → SURVIVED

3.3
Location : addInliner
Killed by : none
replaced return value with null for fr/sii/ogham/html/inliner/EveryImageInliner::addInliner → TIMED_OUT

Active mutators

Tests examined


Report generated by PIT OGHAM