GH-253 - Let @ApplicationModuleTest be meta-annotated with @SpringBootTest.
@ApplicationModuleTest is now meta-annotated with @SpringBootTest. This allows us to remove a couple of declarations that we actually had copied from it (such as the TestContextBootstrapper, the SpringExtension etc.) The presence of the original annotation allow test-related auto-configuration to inspect @SprignBootTest for particular configuration. For example, we now alias the WebEnvironment to make it configurable for the test execution.
This commit is contained in:
@@ -15,9 +15,16 @@
|
||||
*/
|
||||
package com.acme.myproject.moduleA;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.modulith.test.ApplicationModuleTest;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link ApplicationModuleTest}.
|
||||
@@ -36,4 +43,19 @@ class ApplicationModuleTestIntegrationTests {
|
||||
@Test // GH-173
|
||||
void bootstrapsSecondLevelMestMethod() {}
|
||||
}
|
||||
|
||||
// GH-253
|
||||
@Nested
|
||||
@ApplicationModuleTest(verifyAutomatically = false)
|
||||
@ContextConfiguration
|
||||
@AutoConfigureWebTestClient
|
||||
class SampleTest {
|
||||
|
||||
@Autowired ApplicationContext context;
|
||||
|
||||
@Test
|
||||
void registersTestWebClient() {
|
||||
assertThat(context.getBean(WebTestClient.class)).isNotNull();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user