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