BAEL-4785 | Refactor | indentation and pmd violation fix
This commit is contained in:
parent
8c2db90f7f
commit
e183a0a9e5
@ -5,7 +5,7 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Qualifier("cat")
|
@Qualifier("cat")
|
||||||
public class Cat implements Animal{
|
public class Cat implements Animal {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String name() {
|
public String name() {
|
||||||
|
@ -6,7 +6,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class MessagingServiceImpl implements MessagingService{
|
public class MessagingServiceImpl implements MessagingService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@Qualifier("qualifierComponent")
|
@Qualifier("qualifierComponent")
|
||||||
|
@ -13,7 +13,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
public class SpringBeanNamingTest {
|
public class SpringBeanNamingUnitTest {
|
||||||
|
|
||||||
private AnnotationConfigApplicationContext context;
|
private AnnotationConfigApplicationContext context;
|
||||||
|
|
||||||
@ -24,29 +24,29 @@ public class SpringBeanNamingTest {
|
|||||||
context.refresh();
|
context.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
// To name a bean spring gets the class name and converts the first letter to lowercase.
|
// To name a bean spring gets the class name and converts the first letter to lowercase.
|
||||||
// Default naming strategy of the spring bean which is using class level annotation
|
// Default naming strategy of the spring bean which is using class level annotation
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void givenLoggingServiceBeanIsCreated_whenThereIsNoValueProvided_thenBeanNameShouldBeDefaultName() {
|
void givenLoggingServiceBeanIsCreated_whenThereIsNoValueProvided_thenBeanNameShouldBeDefaultName() {
|
||||||
assertNotNull(context.getBean("loggingService"));
|
assertNotNull(context.getBean("loggingService"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// In this case, to name a bean spring gets the class name and converts the first letter to lowercase.
|
// In this case, to name a bean spring gets the class name and converts the first letter to lowercase.
|
||||||
@Test
|
@Test
|
||||||
void givenAuditServiceBeanIsCreatedWithMethodLevelAnnotation_whenThereIsNoValueProvided_thenBeanNameShouldBeTheNameOfMethod() {
|
void givenAuditServiceBeanIsCreatedWithMethodLevelAnnotation_whenThereIsNoValueProvided_thenBeanNameShouldBeTheNameOfMethod() {
|
||||||
assertNotNull(context.getBean("audit"));
|
assertNotNull(context.getBean("audit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// To name a bean spring gets the class name and converts the first letter to lowercase.
|
// To name a bean spring gets the class name and converts the first letter to lowercase.
|
||||||
// Default naming strategy of the spring bean which is using class level annotation
|
// Default naming strategy of the spring bean which is using class level annotation
|
||||||
@Test
|
@Test
|
||||||
void givenLoggingGatewayBeanIsCreatedWithFieldLevelAnnotation_whenThereIsNoValueProvided_thenBeanNameShouldBeDefaultName() {
|
void givenLoggingGatewayBeanIsCreatedWithFieldLevelAnnotation_whenThereIsNoValueProvided_thenBeanNameShouldBeDefaultName() {
|
||||||
assertNotNull(context.getBean("loggingGateway"));
|
assertNotNull(context.getBean("loggingGateway"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// spring will create the bean of type CustomComponent with the name "myBean".
|
// spring will create the bean of type CustomComponent with the name "myBean".
|
||||||
// As we're explicitly giving the name to the bean, spring will use this name to refer to it.
|
// As we're explicitly giving the name to the bean, spring will use this name to refer to it.
|
||||||
@Test
|
@Test
|
||||||
void givenCustomComponentBeanIsCreate_whenThereIsCustomNameGivenToBean_thenBeanShouldBeIdentifiedByThatName() {
|
void givenCustomComponentBeanIsCreate_whenThereIsCustomNameGivenToBean_thenBeanShouldBeIdentifiedByThatName() {
|
||||||
assertNotNull(context.getBean("myBean"));
|
assertNotNull(context.getBean("myBean"));
|
Loading…
x
Reference in New Issue
Block a user