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 1 1. inline : removed call to fr/sii/ogham/html/inliner/ContentWithImages::setContent → RUN_ERROR
			combined.setContent(partial.getContent());
36 1 1. inline : removed call to fr/sii/ogham/html/inliner/ContentWithImages::addAttachments → RUN_ERROR
			combined.addAttachments(partial.getAttachments());
37
		}
38 1 1. inline : replaced return value with null for fr/sii/ogham/html/inliner/EveryImageInliner::inline → RUN_ERROR
		return combined;
39
	}
40
41
	public EveryImageInliner addInliner(ImageInliner inliner) {
42
		inliners.add(inliner);
43 1 1. addInliner : replaced return value with null for fr/sii/ogham/html/inliner/EveryImageInliner::addInliner → RUN_ERROR
		return this;
44
	}
45
}

Mutations

35

1.1
Location : inline
Killed by :
removed call to fr/sii/ogham/html/inliner/ContentWithImages::setContent → RUN_ERROR

36

1.1
Location : inline
Killed by :
removed call to fr/sii/ogham/html/inliner/ContentWithImages::addAttachments → RUN_ERROR

38

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

43

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

Active mutators

Tests examined


Report generated by PIT 1.13.1