SubjectFiller.java

1
package fr.sii.ogham.core.filler;
2
3
import fr.sii.ogham.core.message.Message;
4
import fr.sii.ogham.core.message.capability.HasSubject;
5
import fr.sii.ogham.core.subject.provider.SubjectProvider;
6
7
/**
8
 * Message filler that provides a subject to the message. If the message has
9
 * subject capability (implements {@link HasSubject}) and if the current subject
10
 * is null, then this filler asks to a {@link SubjectProvider} to generate a
11
 * subject.
12
 * 
13
 * @author Aurélien Baudet
14
 *
15
 */
16
public class SubjectFiller implements MessageFiller {
17
	/**
18
	 * The subject provider used to generate the subject
19
	 */
20
	private SubjectProvider subjectProvider;
21
22
	/**
23
	 * Initializes the filler with the provider that will generate the subject
24
	 * value
25
	 * 
26
	 * @param subjectProvider
27
	 *            used to generate the subject value
28
	 */
29
	public SubjectFiller(SubjectProvider subjectProvider) {
30
		super();
31
		this.subjectProvider = subjectProvider;
32
	}
33
34
	@Override
35
	public void fill(Message message) {
36 1 1. fill : negated conditional → RUN_ERROR
		if (message instanceof HasSubject) {
37
			HasSubject msg = (HasSubject) message;
38
			// only try to set the subject if none is provided
39 1 1. fill : negated conditional → RUN_ERROR
			if (msg.getSubject() == null) {
40
				String subject = subjectProvider.provide(message);
41 1 1. fill : negated conditional → RUN_ERROR
				if (subject != null) {
42 1 1. fill : removed call to fr/sii/ogham/core/message/capability/HasSubject::setSubject → NO_COVERAGE
					msg.setSubject(subject);
43
				}
44
			}
45
		}
46
	}
47
48
}

Mutations

36

1.1
Location : fill
Killed by :
negated conditional → RUN_ERROR

39

1.1
Location : fill
Killed by :
negated conditional → RUN_ERROR

41

1.1
Location : fill
Killed by :
negated conditional → RUN_ERROR

42

1.1
Location : fill
Killed by :
removed call to fr/sii/ogham/core/message/capability/HasSubject::setSubject → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.13.1