Polishing
This commit is contained in:
parent
1732844137
commit
7d197972e0
|
|
@ -16,7 +16,8 @@ by default, exactly in the following order:
|
|||
Micrometer's `ObservationRegistry`.
|
||||
* `DirtiesContextTestExecutionListener`: Handles the `@DirtiesContext` annotation for
|
||||
"`after`" modes.
|
||||
* `CommonCacheTestExecutionListener`: Clears application context cache if necessary.
|
||||
* `CommonCacheTestExecutionListener`: Clears resource caches in the test's
|
||||
`ApplicationContext` if necessary.
|
||||
* `TransactionalTestExecutionListener`: Provides transactional test execution with
|
||||
default rollback semantics.
|
||||
* `SqlScriptsTestExecutionListener`: Runs SQL scripts configured by using the `@Sql`
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ org.springframework.test.context.TestExecutionListener = \
|
|||
org.springframework.test.context.event.ApplicationEventsTestExecutionListener,\
|
||||
org.springframework.test.context.bean.override.mockito.MockitoTestExecutionListener,\
|
||||
org.springframework.test.context.support.DependencyInjectionTestExecutionListener,\
|
||||
org.springframework.test.context.support.CommonCacheTestExecutionListener,\
|
||||
org.springframework.test.context.observation.MicrometerObservationRegistryTestExecutionListener,\
|
||||
org.springframework.test.context.support.DirtiesContextTestExecutionListener,\
|
||||
org.springframework.test.context.support.CommonCacheTestExecutionListener,\
|
||||
org.springframework.test.context.transaction.TransactionalTestExecutionListener,\
|
||||
org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener,\
|
||||
org.springframework.test.context.event.EventPublishingTestExecutionListener,\
|
||||
|
|
|
|||
|
|
@ -30,20 +30,19 @@ import org.springframework.context.annotation.Lazy;
|
|||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.core.type.classreading.MetadataReader;
|
||||
import org.springframework.test.context.cache.SpringExtensionCommonCacheTests.TestConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests that verify that common caches are cleared at the end of a test
|
||||
* class. Regular callback cannot be used to validate this as they run
|
||||
* class. Regular callbacks cannot be used to validate this as they run
|
||||
* before the listener, so we need two test classes that are ordered to
|
||||
* validate the result.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@SpringJUnitConfig(classes = TestConfiguration.class)
|
||||
@SpringJUnitConfig
|
||||
@TestClassOrder(ClassOrderer.OrderAnnotation.class)
|
||||
class SpringExtensionCommonCacheTests {
|
||||
|
||||
|
|
@ -56,7 +55,7 @@ class SpringExtensionCommonCacheTests {
|
|||
|
||||
@Test
|
||||
void lazyInitBeans() {
|
||||
applicationContext.getBean(String.class);
|
||||
assertThat(applicationContext.getBean(String.class)).isEqualTo("Dummy");
|
||||
assertThat(applicationContext.getResourceCache(MetadataReader.class)).isNotEmpty();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue