MultipleCauseExceptionWrapper.java

1
package fr.sii.ogham.core.exception;
2
3
import static fr.sii.ogham.core.CoreConstants.SERIAL_VERSION_UID;
4
import static java.util.Collections.unmodifiableList;
5
6
import java.util.List;
7
import java.util.stream.Collectors;
8
9
import fr.sii.ogham.core.util.ExceptionUtils;
10
11
public class MultipleCauseExceptionWrapper extends Exception {
12
	private static final long serialVersionUID = SERIAL_VERSION_UID;
13
14
	private final List<Exception> causes;
15
16
	public MultipleCauseExceptionWrapper(String message, List<Exception> causes) {
17
		super(message);
18
		this.causes = unmodifiableList(causes);
19
	}
20
21
	public MultipleCauseExceptionWrapper(List<Exception> causes) {
22
		super(toCauseString(causes));
23
		this.causes = unmodifiableList(causes);
24
	}
25
26
	public List<Exception> getCauses() {
27 2 1. getCauses : replaced return value with Collections.emptyList for fr/sii/ogham/core/exception/MultipleCauseExceptionWrapper::getCauses → NO_COVERAGE
2. getCauses : replaced return value with Collections.emptyList for fr/sii/ogham/core/exception/MultipleCauseExceptionWrapper::getCauses → KILLED
		return causes;
28
	}
29
	
30
	private static String toCauseString(List<Exception> causes) {
31 2 1. toCauseString : replaced return value with "" for fr/sii/ogham/core/exception/MultipleCauseExceptionWrapper::toCauseString → NO_COVERAGE
2. toCauseString : replaced return value with "" for fr/sii/ogham/core/exception/MultipleCauseExceptionWrapper::toCauseString → SURVIVED
		return causes.stream()
32
				.map(ExceptionUtils::toString)
33
				.collect(Collectors.joining("\n- ", "List of original failures:\n- ", "\n"));
34
	}
35
}

Mutations

27

1.1
Location : getCauses
Killed by : oghamcore.ut.core.sender.FallbackSenderTest.allFailsShouldFailWithDetailledInformation(oghamcore.ut.core.sender.FallbackSenderTest)
replaced return value with Collections.emptyList for fr/sii/ogham/core/exception/MultipleCauseExceptionWrapper::getCauses → KILLED

2.2
Location : getCauses
Killed by : none
replaced return value with Collections.emptyList for fr/sii/ogham/core/exception/MultipleCauseExceptionWrapper::getCauses → NO_COVERAGE

31

1.1
Location : toCauseString
Killed by : none
replaced return value with "" for fr/sii/ogham/core/exception/MultipleCauseExceptionWrapper::toCauseString → NO_COVERAGE

2.2
Location : toCauseString
Killed by : none
replaced return value with "" for fr/sii/ogham/core/exception/MultipleCauseExceptionWrapper::toCauseString → SURVIVED

Active mutators

Tests examined


Report generated by PIT OGHAM