StringContent.java

1
package fr.sii.ogham.core.message.content;
2
3
import fr.sii.ogham.core.util.EqualsBuilder;
4
import fr.sii.ogham.core.util.HashCodeBuilder;
5
6
/**
7
 * Represent a string content. This implementation is the most basic one. It
8
 * just wraps a string into a {@link Content}.
9
 * 
10
 * @author Aurélien Baudet
11
 *
12
 */
13
public class StringContent implements MayHaveStringContent, UpdatableStringContent {
14
	/**
15
	 * The content as string
16
	 */
17
	private String content;
18
19
	/**
20
	 * Initialize the content with the string.
21
	 * 
22
	 * @param content
23
	 *            the content value
24
	 */
25
	public StringContent(String content) {
26
		super();
27
		this.content = content;
28
	}
29
30
	@Override
31
	public String toString() {
32 1 1. toString : replaced return value with "" for fr/sii/ogham/core/message/content/StringContent::toString → RUN_ERROR
		return content;
33
	}
34
35
	@Override
36
	public boolean canProvideString() {
37 1 1. canProvideString : replaced boolean return with false for fr/sii/ogham/core/message/content/StringContent::canProvideString → RUN_ERROR
		return true;
38
	}
39
40
	@Override
41
	public String asString() {
42 1 1. asString : replaced return value with "" for fr/sii/ogham/core/message/content/StringContent::asString → RUN_ERROR
		return content;
43
	}
44
45
	@Override
46
	public void setStringContent(String content) {
47
		this.content = content;
48
	}
49
50
	@Override
51
	public int hashCode() {
52 1 1. hashCode : replaced int return with 0 for fr/sii/ogham/core/message/content/StringContent::hashCode → RUN_ERROR
		return new HashCodeBuilder().append(content).hashCode();
53
	}
54
55
	@Override
56
	public boolean equals(Object obj) {
57 2 1. equals : replaced boolean return with true for fr/sii/ogham/core/message/content/StringContent::equals → RUN_ERROR
2. equals : replaced boolean return with false for fr/sii/ogham/core/message/content/StringContent::equals → RUN_ERROR
		return new EqualsBuilder(this, obj).appendFields("content").isEqual();
58
	}
59
}

Mutations

32

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

37

1.1
Location : canProvideString
Killed by :
replaced boolean return with false for fr/sii/ogham/core/message/content/StringContent::canProvideString → RUN_ERROR

42

1.1
Location : asString
Killed by :
replaced return value with "" for fr/sii/ogham/core/message/content/StringContent::asString → RUN_ERROR

52

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

57

1.1
Location : equals
Killed by :
replaced boolean return with true for fr/sii/ogham/core/message/content/StringContent::equals → RUN_ERROR

2.2
Location : equals
Killed by :
replaced boolean return with false for fr/sii/ogham/core/message/content/StringContent::equals → RUN_ERROR

Active mutators

Tests examined


Report generated by PIT 1.13.1