| 1 | package fr.sii.ogham.template.common.adapter; | |
| 2 | ||
| 3 | import fr.sii.ogham.core.message.capability.HasVariant; | |
| 4 | import fr.sii.ogham.core.message.content.TemplateContent; | |
| 5 | import fr.sii.ogham.core.message.content.Variant; | |
| 6 | import fr.sii.ogham.core.resource.path.ResourcePath; | |
| 7 | import fr.sii.ogham.template.exception.VariantResolutionException; | |
| 8 | ||
| 9 | public class FailIfNotFoundVariantResolver implements VariantResolver { | |
| 10 | ||
| 11 | @Override | |
| 12 | public ResourcePath getRealPath(TemplateContent template) throws VariantResolutionException { | |
| 13 |
1
1. getRealPath : negated conditional → NO_COVERAGE |
if (!(template instanceof HasVariant)) { |
| 14 |
1
1. getRealPath : replaced return value with null for fr/sii/ogham/template/common/adapter/FailIfNotFoundVariantResolver::getRealPath → NO_COVERAGE |
return template.getPath(); |
| 15 | } | |
| 16 | Variant variant = ((HasVariant) template).getVariant(); | |
| 17 | throw new VariantResolutionException("Failed to resolve variant (" + variant + ") for template "+template.getPath().getOriginalPath(), template.getPath(), template.getContext(), variant); | |
| 18 | } | |
| 19 | ||
| 20 | /** | |
| 21 | * Returns true to make it fail | |
| 22 | */ | |
| 23 | @Override | |
| 24 | public boolean variantExists(TemplateContent template) { | |
| 25 |
1
1. variantExists : replaced boolean return with false for fr/sii/ogham/template/common/adapter/FailIfNotFoundVariantResolver::variantExists → NO_COVERAGE |
return true; |
| 26 | } | |
| 27 | ||
| 28 | } | |
Mutations | ||
| 13 |
1.1 |
|
| 14 |
1.1 |
|
| 25 |
1.1 |