| 1 | package fr.sii.ogham.core.exception; | |
| 2 | ||
| 3 | import static fr.sii.ogham.core.CoreConstants.SERIAL_VERSION_UID; | |
| 4 | ||
| 5 | import java.util.HashSet; | |
| 6 | import java.util.Set; | |
| 7 | ||
| 8 | import fr.sii.ogham.core.message.Message; | |
| 9 | ||
| 10 | /** | |
| 11 | * Specialized exception that is thrown when a message is not valid (some fields | |
| 12 | * are required or need to conform a particular format). This exception provides | |
| 13 | * the violations. | |
| 14 | * | |
| 15 | * @author Aurélien Baudet | |
| 16 | * | |
| 17 | */ | |
| 18 | public class InvalidMessageException extends MessageException { | |
| 19 | private static final long serialVersionUID = SERIAL_VERSION_UID; | |
| 20 | ||
| 21 | private final Set<String> violations; | |
| 22 | ||
| 23 | public InvalidMessageException(String message, Message msg, Set<String> violations) { | |
| 24 | super(message, msg); | |
| 25 | this.violations = violations; | |
| 26 | } | |
| 27 | ||
| 28 | public InvalidMessageException(String message, Message msg, String violation) { | |
| 29 | this(message, msg, new HashSet<>()); | |
| 30 | violations.add(violation); | |
| 31 | } | |
| 32 | ||
| 33 | public Set<String> getViolations() { | |
| 34 |
1
1. getViolations : replaced return value with Collections.emptyList for fr/sii/ogham/core/exception/InvalidMessageException::getViolations → NO_COVERAGE |
return violations; |
| 35 | } | |
| 36 | } | |
Mutations | ||
| 34 |
1.1 |