Skip to content

Instantly share code, notes, and snippets.

@thanglequoc
Last active September 16, 2019 13:33
Show Gist options
  • Select an option

  • Save thanglequoc/04a89c6ee41d7dbe9c063daaf98c9821 to your computer and use it in GitHub Desktop.

Select an option

Save thanglequoc/04a89c6ee41d7dbe9c063daaf98c9821 to your computer and use it in GitHub Desktop.
Spring Boot Test Configuration
//@ContextConfiguration(classes = { H2ContextConfiguration.class })
//@EnableAutoConfiguration
//@TestPropertySource(locations = "classpath:/application-test.properties")
//@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
//@EnableAutoConfiguration
//@SpringBootTest(classes = OrderServiceIntegrationTestContext.class, webEnvironment = SpringBootTest.WebEnvironment.NONE)
//@RunWith(SpringRunner.class)
//@ContextConfiguration(classes = { H2ContextConfiguration.class })
//@EnableAutoConfiguration
//@TestPropertySource(locations = "classpath:/application-test.properties")
//@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
@RunWith(SpringRunner.class)
@ComponentScan(
includeFilters = {
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE,
value = { OrderService.class, OrderServiceImpl.class})
},
excludeFilters = {
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE,
value = { DatabaseConfiguration.class, ActivitiBPMConfiguration.class, ElasticsearchConfiguration.class,
ElasticSearchUpdater.class, CacheConfiguration.class, MetricsConfiguration.class}),
@ComponentScan.Filter(type = FilterType.REGEX,
pattern = {"vn.nextlogix.repository.search.*"})})
public class OrderServiceIntegrationTestContext {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment