| 1 | package fr.sii.ogham.testing.extension.spring; | |
| 2 | ||
| 3 | import ogham.testing.com.icegreen.greenmail.junit4.GreenMailRule; | |
| 4 | import ogham.testing.com.icegreen.greenmail.junit5.GreenMailExtension; | |
| 5 | import ogham.testing.com.icegreen.greenmail.util.ServerSetup; | |
| 6 | import org.springframework.beans.factory.annotation.Value; | |
| 7 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | |
| 8 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
| 9 | import org.springframework.boot.test.context.TestConfiguration; | |
| 10 | import org.springframework.context.annotation.Bean; | |
| 11 | import org.springframework.context.annotation.Import; | |
| 12 | ||
| 13 | ||
| 14 | /** | |
| 15 | * Test configuration that registers: | |
| 16 | * <ul> | |
| 17 | * <li>{@link GreenMailRule} bean for JUnit 4</li> | |
| 18 | * <li>{@link GreenMailExtension} bean for JUnit 5</li> | |
| 19 | * <li>Configure port defined by {@code greenmail.smtp.port} property.</li> | |
| 20 | * </ul> | |
| 21 | * | |
| 22 | * @author Aurélien Baudet | |
| 23 | * | |
| 24 | */ | |
| 25 | @TestConfiguration | |
| 26 | @Import(GreenMailRuleTestConfiguration.class) | |
| 27 | public class GreenMailTestConfiguration { | |
| 28 | @Bean | |
| 29 | @ConditionalOnMissingBean(GreenMailExtension.class) | |
| 30 | @ConditionalOnProperty("greenmail.smtp.port") | |
| 31 | public GreenMailExtension randomSmtpPortGreenMailExtension(@Value("${greenmail.smtp.port}") int port) { | |
| 32 |
1
1. randomSmtpPortGreenMailExtension : replaced return value with null for fr/sii/ogham/testing/extension/spring/GreenMailTestConfiguration::randomSmtpPortGreenMailExtension → NO_COVERAGE |
return new GreenMailExtension(new ServerSetup(port, null, ServerSetup.PROTOCOL_SMTP)); |
| 33 | } | |
| 34 | } | |
Mutations | ||
| 32 |
1.1 |