OverrideNameWrapperResourceTranslator.java

1
package fr.sii.ogham.core.translator.resource;
2
3
import org.slf4j.Logger;
4
import org.slf4j.LoggerFactory;
5
6
import fr.sii.ogham.core.resource.OverrideNameWrapper;
7
import fr.sii.ogham.core.resource.Resource;
8
import fr.sii.ogham.email.exception.attachment.translator.ResourceTranslatorException;
9
10
/**
11
 * <p>
12
 * Translator that handles {@link OverrideNameWrapper}. It delegates to another
13
 * {@link AttachmentResourceTranslator} to get handle the wrapped
14
 * {@link Resource}. The handled {@link Resource} is then re-wrapped into a
15
 * {@link OverrideNameWrapper}.
16
 * 
17
 * @author Aurélien Baudet
18
 *
19
 */
20
public class OverrideNameWrapperResourceTranslator implements AttachmentResourceTranslator {
21
	private static final Logger LOG = LoggerFactory.getLogger(OverrideNameWrapperResourceTranslator.class);
22
23
	private final AttachmentResourceTranslator delegate;
24
25
	public OverrideNameWrapperResourceTranslator(AttachmentResourceTranslator delegate) {
26
		super();
27
		this.delegate = delegate;
28
	}
29
30
	@Override
31
	public Resource translate(Resource resource) throws ResourceTranslatorException {
32 3 1. translate : negated conditional → NO_COVERAGE
2. translate : negated conditional → KILLED
3. translate : negated conditional → KILLED
		if (resource instanceof OverrideNameWrapper) {
33
			OverrideNameWrapper namedResource = (OverrideNameWrapper) resource;
34
			Resource translated = delegate.translate(namedResource.getDelegate());
35 2 1. translate : replaced return value with null for fr/sii/ogham/core/translator/resource/OverrideNameWrapperResourceTranslator::translate → NO_COVERAGE
2. translate : replaced return value with null for fr/sii/ogham/core/translator/resource/OverrideNameWrapperResourceTranslator::translate → KILLED
			return new OverrideNameWrapper(translated, namedResource.getName());
36
		} else {
37
			LOG.trace("Not a OverrideNameWrapper => skip it");
38 3 1. translate : replaced return value with null for fr/sii/ogham/core/translator/resource/OverrideNameWrapperResourceTranslator::translate → NO_COVERAGE
2. translate : replaced return value with null for fr/sii/ogham/core/translator/resource/OverrideNameWrapperResourceTranslator::translate → KILLED
3. translate : replaced return value with null for fr/sii/ogham/core/translator/resource/OverrideNameWrapperResourceTranslator::translate → KILLED
			return resource;
39
		}
40
	}
41
42
	@Override
43
	public String toString() {
44 3 1. toString : replaced return value with "" for fr/sii/ogham/core/translator/resource/OverrideNameWrapperResourceTranslator::toString → SURVIVED
2. toString : replaced return value with "" for fr/sii/ogham/core/translator/resource/OverrideNameWrapperResourceTranslator::toString → NO_COVERAGE
3. toString : replaced return value with "" for fr/sii/ogham/core/translator/resource/OverrideNameWrapperResourceTranslator::toString → TIMED_OUT
		return "OverrideNameWrapperResourceTranslator";
45
	}
46
47
}

Mutations

32

1.1
Location : translate
Killed by : oghamall.it.email.EmailSMTPDefaultsTest.attachmentLookup(oghamall.it.email.EmailSMTPDefaultsTest)
negated conditional → KILLED

2.2
Location : translate
Killed by : oghamjavamail.it.UnreadableAttachmentTest.attachmentUnreadable(oghamjavamail.it.UnreadableAttachmentTest)
negated conditional → KILLED

3.3
Location : translate
Killed by : none
negated conditional → NO_COVERAGE

35

1.1
Location : translate
Killed by : oghamall.it.email.FluentEmailTest.attachResource(oghamall.it.email.FluentEmailTest)
replaced return value with null for fr/sii/ogham/core/translator/resource/OverrideNameWrapperResourceTranslator::translate → KILLED

2.2
Location : translate
Killed by : none
replaced return value with null for fr/sii/ogham/core/translator/resource/OverrideNameWrapperResourceTranslator::translate → NO_COVERAGE

38

1.1
Location : translate
Killed by : none
replaced return value with null for fr/sii/ogham/core/translator/resource/OverrideNameWrapperResourceTranslator::translate → NO_COVERAGE

2.2
Location : translate
Killed by : oghamall.it.email.EmailSMTPDefaultsTest.attachmentLookup(oghamall.it.email.EmailSMTPDefaultsTest)
replaced return value with null for fr/sii/ogham/core/translator/resource/OverrideNameWrapperResourceTranslator::translate → KILLED

3.3
Location : translate
Killed by : oghamjavamail.it.UnreadableAttachmentTest.attachmentUnreadable(oghamjavamail.it.UnreadableAttachmentTest)
replaced return value with null for fr/sii/ogham/core/translator/resource/OverrideNameWrapperResourceTranslator::translate → KILLED

44

1.1
Location : toString
Killed by : none
replaced return value with "" for fr/sii/ogham/core/translator/resource/OverrideNameWrapperResourceTranslator::toString → SURVIVED

2.2
Location : toString
Killed by : none
replaced return value with "" for fr/sii/ogham/core/translator/resource/OverrideNameWrapperResourceTranslator::toString → NO_COVERAGE

3.3
Location : toString
Killed by : none
replaced return value with "" for fr/sii/ogham/core/translator/resource/OverrideNameWrapperResourceTranslator::toString → TIMED_OUT

Active mutators

Tests examined


Report generated by PIT OGHAM