Merge pull request #7920 from kumar-devender/master
rename test cases to follow BDD style
This commit is contained in:
commit
25023df560
@ -19,7 +19,7 @@ import static org.hamcrest.CoreMatchers.*;
|
|||||||
public class ComponentScanAnnotationFilterAppIntegrationTest {
|
public class ComponentScanAnnotationFilterAppIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBean() {
|
public void whenAnnotationFilterIsUsed_thenComponentScanShouldRegisterBeanAnnotatedWithAnimalAnootation() {
|
||||||
ApplicationContext applicationContext = new AnnotationConfigApplicationContext(ComponentScanAnnotationFilterApp.class);
|
ApplicationContext applicationContext = new AnnotationConfigApplicationContext(ComponentScanAnnotationFilterApp.class);
|
||||||
List<String> beans = Arrays.stream(applicationContext.getBeanDefinitionNames())
|
List<String> beans = Arrays.stream(applicationContext.getBeanDefinitionNames())
|
||||||
.filter(bean -> !bean.contains("org.springframework") && !bean.contains("componentScanAnnotationFilterApp"))
|
.filter(bean -> !bean.contains("org.springframework") && !bean.contains("componentScanAnnotationFilterApp"))
|
||||||
|
@ -19,10 +19,10 @@ import static org.hamcrest.CoreMatchers.*;
|
|||||||
public class ComponentScanAspectJFilterAppIntegrationTest {
|
public class ComponentScanAspectJFilterAppIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBean() {
|
public void whenAspectJFilterIsUsed_thenComponentScanShouldRegisterBeanMatchingAspectJCreteria() {
|
||||||
ApplicationContext applicationContext = new AnnotationConfigApplicationContext(ComponentScanAspectJFilterApp.class);
|
ApplicationContext applicationContext = new AnnotationConfigApplicationContext(ComponentScanAspectJFilterApp.class);
|
||||||
List<String> beans = Arrays.stream(applicationContext.getBeanDefinitionNames())
|
List<String> beans = Arrays.stream(applicationContext.getBeanDefinitionNames())
|
||||||
.filter(bean -> !bean.contains("org.springframework") && !bean.contains("componentScanCustomFilterApp"))
|
.filter(bean -> !bean.contains("org.springframework") && !bean.contains("componentScanAspectJFilterApp"))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
assertThat(beans.size(), equalTo(1));
|
assertThat(beans.size(), equalTo(1));
|
||||||
assertThat(beans.get(0), equalTo("elephant"));
|
assertThat(beans.get(0), equalTo("elephant"));
|
||||||
|
@ -19,7 +19,7 @@ import static org.hamcrest.CoreMatchers.*;
|
|||||||
public class ComponentScanAssignableTypeFilterAppIntegrationTest {
|
public class ComponentScanAssignableTypeFilterAppIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBean() {
|
public void whenAssignableTypeFilterIsUsed_thenComponentScanShouldRegisterBeanOfAssignableTypeAndItsSubClass() {
|
||||||
ApplicationContext applicationContext = new AnnotationConfigApplicationContext(ComponentScanAssignableTypeFilterApp.class);
|
ApplicationContext applicationContext = new AnnotationConfigApplicationContext(ComponentScanAssignableTypeFilterApp.class);
|
||||||
List<String> beans = Arrays.stream(applicationContext.getBeanDefinitionNames())
|
List<String> beans = Arrays.stream(applicationContext.getBeanDefinitionNames())
|
||||||
.filter(bean -> !bean.contains("org.springframework") && !bean.contains("componentScanAssignableTypeFilterApp"))
|
.filter(bean -> !bean.contains("org.springframework") && !bean.contains("componentScanAssignableTypeFilterApp"))
|
||||||
|
@ -19,7 +19,7 @@ import static org.hamcrest.CoreMatchers.*;
|
|||||||
public class ComponentScanCustomFilterAppIntegrationTest {
|
public class ComponentScanCustomFilterAppIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBean() {
|
public void whenCustomFilterIsUsed_thenComponentScanShouldRegisterBeanMatchingCustomFilter() {
|
||||||
ApplicationContext applicationContext = new AnnotationConfigApplicationContext(ComponentScanCustomFilterApp.class);
|
ApplicationContext applicationContext = new AnnotationConfigApplicationContext(ComponentScanCustomFilterApp.class);
|
||||||
List<String> beans = Arrays.stream(applicationContext.getBeanDefinitionNames())
|
List<String> beans = Arrays.stream(applicationContext.getBeanDefinitionNames())
|
||||||
.filter(bean -> !bean.contains("org.springframework") && !bean.contains("componentScanCustomFilterApp"))
|
.filter(bean -> !bean.contains("org.springframework") && !bean.contains("componentScanCustomFilterApp"))
|
||||||
|
@ -19,7 +19,7 @@ import static org.hamcrest.CoreMatchers.*;
|
|||||||
public class ComponentScanRegexFilterAppIntegrationTest {
|
public class ComponentScanRegexFilterAppIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBean() {
|
public void whenRegexFilterIsUsed_thenComponentScanShouldRegisterBeanMatchingRegex() {
|
||||||
ApplicationContext applicationContext = new AnnotationConfigApplicationContext(ComponentScanRegexFilterApp.class);
|
ApplicationContext applicationContext = new AnnotationConfigApplicationContext(ComponentScanRegexFilterApp.class);
|
||||||
List<String> beans = Arrays.stream(applicationContext.getBeanDefinitionNames())
|
List<String> beans = Arrays.stream(applicationContext.getBeanDefinitionNames())
|
||||||
.filter(bean -> !bean.contains("org.springframework") && !bean.contains("componentScanRegexFilterApp"))
|
.filter(bean -> !bean.contains("org.springframework") && !bean.contains("componentScanRegexFilterApp"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user