EveryFillerDecorator.java

1
package fr.sii.ogham.core.filler;
2
3
import java.util.ArrayList;
4
import java.util.Arrays;
5
import java.util.List;
6
7
import fr.sii.ogham.core.exception.filler.FillMessageException;
8
import fr.sii.ogham.core.message.Message;
9
10
/**
11
 * Decorator that calls every decorated filler in order to fill the message.
12
 * 
13
 * @author Aurélien Baudet
14
 *
15
 */
16
public class EveryFillerDecorator implements MessageFiller {
17
	/**
18
	 * The decorated fillers
19
	 */
20
	private List<MessageFiller> fillers;
21
22
	/**
23
	 * Initializes with some fillers.
24
	 * 
25
	 * @param fillers
26
	 *            the fillers to be called (may be empty)
27
	 */
28
	public EveryFillerDecorator(MessageFiller... fillers) {
29
		this(new ArrayList<>(Arrays.asList(fillers)));
30
	}
31
32
	/**
33
	 * Initializes with some fillers.
34
	 * 
35
	 * @param fillers
36
	 *            the fillers to be called (may be empty)
37
	 */
38
	public EveryFillerDecorator(List<MessageFiller> fillers) {
39
		super();
40
		this.fillers = fillers;
41
	}
42
43
	@Override
44
	public void fill(Message message) throws FillMessageException {
45
		for (MessageFiller filler : fillers) {
46 3 1. fill : removed call to fr/sii/ogham/core/filler/MessageFiller::fill → SURVIVED
2. fill : removed call to fr/sii/ogham/core/filler/MessageFiller::fill → NO_COVERAGE
3. fill : removed call to fr/sii/ogham/core/filler/MessageFiller::fill → KILLED
			filler.fill(message);
47
		}
48
	}
49
50
	/**
51
	 * Register a new filler to be executed.
52
	 * 
53
	 * <p>
54
	 * The filler is registered at the end of the list.
55
	 * </p>
56
	 * 
57
	 * @param filler
58
	 *            the filler to append to the list
59
	 * @return this instance for fluent chaining
60
	 */
61
	public EveryFillerDecorator addFiller(MessageFiller filler) {
62
		fillers.add(filler);
63 2 1. addFiller : replaced return value with null for fr/sii/ogham/core/filler/EveryFillerDecorator::addFiller → SURVIVED
2. addFiller : replaced return value with null for fr/sii/ogham/core/filler/EveryFillerDecorator::addFiller → NO_COVERAGE
		return this;
64
	}
65
}

Mutations

46

1.1
Location : fill
Killed by : oghamall.it.sms.SmsCustomImplTest.simple(oghamall.it.sms.SmsCustomImplTest)
removed call to fr/sii/ogham/core/filler/MessageFiller::fill → KILLED

2.2
Location : fill
Killed by : none
removed call to fr/sii/ogham/core/filler/MessageFiller::fill → SURVIVED

3.3
Location : fill
Killed by : none
removed call to fr/sii/ogham/core/filler/MessageFiller::fill → NO_COVERAGE

63

1.1
Location : addFiller
Killed by : none
replaced return value with null for fr/sii/ogham/core/filler/EveryFillerDecorator::addFiller → SURVIVED

2.2
Location : addFiller
Killed by : none
replaced return value with null for fr/sii/ogham/core/filler/EveryFillerDecorator::addFiller → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT OGHAM