| 1 | package fr.sii.ogham.testing.extension.spring; | |
| 2 | ||
| 3 | import fr.sii.ogham.testing.extension.junit.sms.JsmppServerExtension; | |
| 4 | import fr.sii.ogham.testing.extension.junit.sms.JsmppServerRule; | |
| 5 | import fr.sii.ogham.testing.extension.junit.sms.config.ServerConfig; | |
| 6 | import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | import org.springframework.beans.factory.annotation.Value; | |
| 8 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | |
| 9 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | |
| 10 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
| 11 | import org.springframework.boot.test.context.TestConfiguration; | |
| 12 | import org.springframework.context.annotation.Bean; | |
| 13 | ||
| 14 | /** | |
| 15 | * Test configuration that registers: | |
| 16 | * <ul> | |
| 17 | * <li>{@link JsmppServerRule} bean for JUnit 4</li> | |
| 18 | * </ul> | |
| 19 | * | |
| 20 | * @author Aurélien Baudet | |
| 21 | * | |
| 22 | */ | |
| 23 | @TestConfiguration | |
| 24 | @ConditionalOnClass(org.junit.rules.TestRule.class) | |
| 25 | public class JsmppServerRuleTestConfiguration { | |
| 26 | @Bean | |
| 27 | @ConditionalOnMissingBean(JsmppServerRule.class) | |
| 28 | @ConditionalOnProperty("jsmpp.server.port") | |
| 29 | public JsmppServerRule randomJsmppPortRule(@Value("${jsmpp.server.port}") int port, @Autowired(required = false) ServerConfig config) { | |
| 30 |
1
1. randomJsmppPortRule : replaced return value with null for fr/sii/ogham/testing/extension/spring/JsmppServerRuleTestConfiguration::randomJsmppPortRule → NO_COVERAGE |
return new JsmppServerRule(initConfig(port, config)); |
| 31 | } | |
| 32 | ||
| 33 | private static ServerConfig initConfig(int port, ServerConfig config) { | |
| 34 |
1
1. initConfig : negated conditional → NO_COVERAGE |
if (config == null) { |
| 35 | config = new ServerConfig(); | |
| 36 | } | |
| 37 | config.port(port); | |
| 38 |
1
1. initConfig : replaced return value with null for fr/sii/ogham/testing/extension/spring/JsmppServerRuleTestConfiguration::initConfig → NO_COVERAGE |
return config; |
| 39 | } | |
| 40 | } | |
Mutations | ||
| 30 |
1.1 |
|
| 34 |
1.1 |
|
| 38 |
1.1 |