NamedCharset.java

1
package fr.sii.ogham.sms.sender.impl.cloudhopper.encoder;
2
3
import com.cloudhopper.commons.charset.Charset;
4
import com.cloudhopper.commons.charset.CharsetUtil;
5
6
/**
7
 * Wrapper of {@link Charset} that tracks the name of the charset.
8
 * 
9
 * @author Aurélien Baudet
10
 *
11
 */
12
public class NamedCharset {
13
	private final String charsetName;
14
	private final Charset charset;
15
16
	/**
17
	 * Initializes with the name and the corresponding charset.
18
	 * 
19
	 * @param charsetName
20
	 *            the name of the charset
21
	 * @param charset
22
	 *            the corresponding charset
23
	 */
24
	public NamedCharset(String charsetName, Charset charset) {
25
		super();
26
		this.charsetName = charsetName;
27
		this.charset = charset;
28
	}
29
30
	/**
31
	 * @return the charset name
32
	 */
33
	public String getCharsetName() {
34 1 1. getCharsetName : replaced return value with "" for fr/sii/ogham/sms/sender/impl/cloudhopper/encoder/NamedCharset::getCharsetName → RUN_ERROR
		return charsetName;
35
	}
36
37
	/**
38
	 * @return the corresponding charset
39
	 */
40
	public Charset getCharset() {
41 1 1. getCharset : replaced return value with null for fr/sii/ogham/sms/sender/impl/cloudhopper/encoder/NamedCharset::getCharset → RUN_ERROR
		return charset;
42
	}
43
44
	/**
45
	 * Convenient method that creates a {@link NamedCharset} from the charset
46
	 * name.
47
	 * 
48
	 * @param charsetName
49
	 *            the charset name
50
	 * @return the charset name with the corresponding {@link Charset}
51
	 */
52
	public static NamedCharset from(String charsetName) {
53 1 1. from : replaced return value with null for fr/sii/ogham/sms/sender/impl/cloudhopper/encoder/NamedCharset::from → RUN_ERROR
		return new NamedCharset(charsetName, CharsetUtil.map(charsetName));
54
	}
55
56
	@Override
57
	public String toString() {
58 1 1. toString : replaced return value with "" for fr/sii/ogham/sms/sender/impl/cloudhopper/encoder/NamedCharset::toString → NO_COVERAGE
		return charsetName + " <-> " + charset;
59
	}
60
}

Mutations

34

1.1
Location : getCharsetName
Killed by :
replaced return value with "" for fr/sii/ogham/sms/sender/impl/cloudhopper/encoder/NamedCharset::getCharsetName → RUN_ERROR

41

1.1
Location : getCharset
Killed by :
replaced return value with null for fr/sii/ogham/sms/sender/impl/cloudhopper/encoder/NamedCharset::getCharset → RUN_ERROR

53

1.1
Location : from
Killed by :
replaced return value with null for fr/sii/ogham/sms/sender/impl/cloudhopper/encoder/NamedCharset::from → RUN_ERROR

58

1.1
Location : toString
Killed by :
replaced return value with "" for fr/sii/ogham/sms/sender/impl/cloudhopper/encoder/NamedCharset::toString → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.13.1