TemplateVariantContent.java

1
package fr.sii.ogham.core.message.content;
2
3
import fr.sii.ogham.core.message.capability.HasVariant;
4
import fr.sii.ogham.core.resource.path.ResourcePath;
5
import fr.sii.ogham.core.resource.path.UnresolvedPath;
6
import fr.sii.ogham.core.template.context.Context;
7
import fr.sii.ogham.core.util.EqualsBuilder;
8
import fr.sii.ogham.core.util.HashCodeBuilder;
9
10
/**
11
 * Content that points to a template variant. The template contains variables.
12
 * The template will be evaluated with the provided context (variable values).
13
 * <p>
14
 * The variant will be evaluated by the template parser to resolve real template
15
 * path.
16
 * 
17
 * @author Aurélien Baudet
18
 *
19
 */
20
public class TemplateVariantContent extends TemplateContent implements HasVariant {
21
	/**
22
	 * The template variant
23
	 */
24
	private final Variant variant;
25
26
	public TemplateVariantContent(String path, Variant variant, Context context) {
27
		this(new UnresolvedPath(path), variant, context);
28
	}
29
30
	public TemplateVariantContent(String path, Variant variant, Object bean) {
31
		this(new UnresolvedPath(path), variant, bean);
32
	}
33
34
	public TemplateVariantContent(ResourcePath path, Variant variant, Context context) {
35
		super(path, context);
36
		this.variant = variant;
37
	}
38
39
	public TemplateVariantContent(ResourcePath path, Variant variant, Object bean) {
40
		super(path, bean);
41
		this.variant = variant;
42
	}
43
44
	@Override
45
	public Variant getVariant() {
46 2 1. getVariant : replaced return value with null for fr/sii/ogham/core/message/content/TemplateVariantContent::getVariant → NO_COVERAGE
2. getVariant : replaced return value with null for fr/sii/ogham/core/message/content/TemplateVariantContent::getVariant → KILLED
		return variant;
47
	}
48
	
49
	@Override
50
	public String toString() {
51
		StringBuilder builder = new StringBuilder();
52
		builder.append("TemplateVariantContent [path=").append(getPath()).append(", variant=").append(variant).append(", context=").append(getContext()).append("]");
53 2 1. toString : replaced return value with "" for fr/sii/ogham/core/message/content/TemplateVariantContent::toString → SURVIVED
2. toString : replaced return value with "" for fr/sii/ogham/core/message/content/TemplateVariantContent::toString → NO_COVERAGE
		return builder.toString();
54
	}
55
56
	@Override
57
	public int hashCode() {
58 1 1. hashCode : replaced int return with 0 for fr/sii/ogham/core/message/content/TemplateVariantContent::hashCode → NO_COVERAGE
		return new HashCodeBuilder().append(getPath(), getContext(), getVariant()).hashCode();
59
	}
60
61
	@Override
62
	public boolean equals(Object obj) {
63 2 1. equals : replaced boolean return with false for fr/sii/ogham/core/message/content/TemplateVariantContent::equals → NO_COVERAGE
2. equals : replaced boolean return with true for fr/sii/ogham/core/message/content/TemplateVariantContent::equals → NO_COVERAGE
		return new EqualsBuilder(this, obj).appendFields("path", "context", "variant").isEqual();
64
	}
65
}

Mutations

46

1.1
Location : getVariant
Killed by : none
replaced return value with null for fr/sii/ogham/core/message/content/TemplateVariantContent::getVariant → NO_COVERAGE

2.2
Location : getVariant
Killed by : oghamall.it.template.TemplateErrorTest.multiTemplateNotFound(oghamall.it.template.TemplateErrorTest)
replaced return value with null for fr/sii/ogham/core/message/content/TemplateVariantContent::getVariant → KILLED

53

1.1
Location : toString
Killed by : none
replaced return value with "" for fr/sii/ogham/core/message/content/TemplateVariantContent::toString → SURVIVED

2.2
Location : toString
Killed by : none
replaced return value with "" for fr/sii/ogham/core/message/content/TemplateVariantContent::toString → NO_COVERAGE

58

1.1
Location : hashCode
Killed by : none
replaced int return with 0 for fr/sii/ogham/core/message/content/TemplateVariantContent::hashCode → NO_COVERAGE

63

1.1
Location : equals
Killed by : none
replaced boolean return with false for fr/sii/ogham/core/message/content/TemplateVariantContent::equals → NO_COVERAGE

2.2
Location : equals
Killed by : none
replaced boolean return with true for fr/sii/ogham/core/message/content/TemplateVariantContent::equals → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT OGHAM