| 1 | package fr.sii.ogham.core.util.converter; | |
| 2 | ||
| 3 | import org.apache.commons.beanutils.converters.AbstractConverter; | |
| 4 | import org.slf4j.Logger; | |
| 5 | import org.slf4j.LoggerFactory; | |
| 6 | ||
| 7 | import fr.sii.ogham.sms.message.Sender; | |
| 8 | ||
| 9 | /** | |
| 10 | * Converts the provided object into an {@link SmsSenderConverter}. This | |
| 11 | * converter is used by Apache Commons BeanUtils library. | |
| 12 | * | |
| 13 | * @author Aurélien Baudet | |
| 14 | * | |
| 15 | */ | |
| 16 | public class SmsSenderConverter extends AbstractConverter { | |
| 17 | private static final Logger LOG = LoggerFactory.getLogger(SmsSenderConverter.class); | |
| 18 | ||
| 19 | @Override | |
| 20 | protected <T> T convertToType(Class<T> type, Object value) throws Throwable { | |
| 21 | LOG.debug("Converting string sms sender {} into Sender", value); | |
| 22 |
4
1. convertToType : negated conditional → NO_COVERAGE 2. convertToType : negated conditional → NO_COVERAGE 3. convertToType : negated conditional → KILLED 4. convertToType : negated conditional → KILLED |
if (value instanceof String && Sender.class.isAssignableFrom(type)) { |
| 23 |
2
1. convertToType : replaced return value with null for fr/sii/ogham/core/util/converter/SmsSenderConverter::convertToType → NO_COVERAGE 2. convertToType : replaced return value with null for fr/sii/ogham/core/util/converter/SmsSenderConverter::convertToType → KILLED |
return type.cast(new Sender((String) value)); |
| 24 | } | |
| 25 | throw conversionException(type, value); | |
| 26 | } | |
| 27 | ||
| 28 | @Override | |
| 29 | protected Class<?> getDefaultType() { | |
| 30 |
1
1. getDefaultType : replaced return value with null for fr/sii/ogham/core/util/converter/SmsSenderConverter::getDefaultType → NO_COVERAGE |
return Sender.class; |
| 31 | } | |
| 32 | ||
| 33 | } | |
Mutations | ||
| 22 |
1.1 2.2 3.3 4.4 |
|
| 23 |
1.1 2.2 |
|
| 30 |
1.1 |