LocaleContext.java

1
package fr.sii.ogham.core.template.context;
2
3
import java.util.Locale;
4
import java.util.Map;
5
6
import fr.sii.ogham.core.exception.template.ContextException;
7
8
/**
9
 * A context that also provides {@link Locale} information for
10
 * internationalization. It allows to explicitly specify the language.
11
 * 
12
 * @author Aurélien Baudet
13
 *
14
 */
15
public class LocaleContext implements Context {
16
	/**
17
	 * The context that contains the variables
18
	 */
19
	private final Context delegate;
20
	
21
	/**
22
	 * The locale to use
23
	 */
24
	private final Locale locale;
25
26
	public LocaleContext(Context delegate, Locale locale) {
27
		super();
28
		this.delegate = delegate;
29
		this.locale = locale;
30
	}
31
32
	public LocaleContext(Object bean, Locale locale) {
33
		this(new BeanContext(bean), locale);
34
	}
35
36
	@Override
37
	public Map<String, Object> getVariables() throws ContextException {
38 1 1. getVariables : replaced return value with Collections.emptyMap for fr/sii/ogham/core/template/context/LocaleContext::getVariables → NO_COVERAGE
		return delegate.getVariables();
39
	}
40
41
	public Locale getLocale() {
42 1 1. getLocale : replaced return value with null for fr/sii/ogham/core/template/context/LocaleContext::getLocale → NO_COVERAGE
		return locale;
43
	}
44
45
	public Context getDelegate() {
46 1 1. getDelegate : replaced return value with null for fr/sii/ogham/core/template/context/LocaleContext::getDelegate → NO_COVERAGE
		return delegate;
47
	}
48
}

Mutations

38

1.1
Location : getVariables
Killed by :
replaced return value with Collections.emptyMap for fr/sii/ogham/core/template/context/LocaleContext::getVariables → NO_COVERAGE

42

1.1
Location : getLocale
Killed by :
replaced return value with null for fr/sii/ogham/core/template/context/LocaleContext::getLocale → NO_COVERAGE

46

1.1
Location : getDelegate
Killed by :
replaced return value with null for fr/sii/ogham/core/template/context/LocaleContext::getDelegate → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.13.1