BAEL-2921 Review: creation of spring-core-2 module
This commit is contained in:
parent
07b49e32c2
commit
72c39bab4c
1
pom.xml
1
pom.xml
@ -659,6 +659,7 @@
|
|||||||
<module>spring-cloud-data-flow</module>
|
<module>spring-cloud-data-flow</module>
|
||||||
|
|
||||||
<module>spring-core</module>
|
<module>spring-core</module>
|
||||||
|
<module>spring-core-2</module>
|
||||||
<module>spring-cucumber</module>
|
<module>spring-cucumber</module>
|
||||||
|
|
||||||
<module>spring-data-rest</module>
|
<module>spring-data-rest</module>
|
||||||
|
60
spring-core-2/pom.xml
Normal file
60
spring-core-2/pom.xml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>parent-spring-5</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<relativePath>../parent-spring-5</relativePath>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>spring-core-2</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-beans</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-core</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<version>${junit.jupiter.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<version>${junit.jupiter.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.22.1</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<spring.version>5.1.4.RELEASE</spring.version>
|
||||||
|
<junit.jupiter.version>5.0.2</junit.jupiter.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
@ -21,9 +21,9 @@ class GetBeanByNameUnitTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenGivenExistingBeanName_shouldReturnThatBean() {
|
void whenGivenExistingBeanName_shouldReturnThatBean() {
|
||||||
Object requestedBean = context.getBean("lion");
|
Object lion = context.getBean("lion");
|
||||||
|
|
||||||
assertEquals(requestedBean.getClass(), Lion.class);
|
assertEquals(lion.getClass(), Lion.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
@ -19,14 +19,20 @@ class GetBeanByNameWithConstructorParametersUnitTest {
|
|||||||
context = new AnnotationConfigApplicationContext(AnnotationConfig.class);
|
context = new AnnotationConfigApplicationContext(AnnotationConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void whenGivenCorrectName_thenShouldReturnBeanWithSpecifiedName() {
|
||||||
|
Tiger tiger = (Tiger) context.getBean("tiger", "Siberian");
|
||||||
|
|
||||||
|
assertEquals("Siberian", tiger.getName());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenGivenCorrectNameOrAlias_shouldReturnBeanWithSpecifiedName() {
|
void whenGivenCorrectNameOrAlias_shouldReturnBeanWithSpecifiedName() {
|
||||||
Tiger tiger = (Tiger) context.getBean("tiger", "Cutie");
|
Tiger tiger = (Tiger) context.getBean("tiger", "Siberian");
|
||||||
Tiger tigerSecond = (Tiger) context.getBean("tiger", "Striped");
|
Tiger secondTiger = (Tiger) context.getBean("tiger", "Striped");
|
||||||
Tiger tigerViaAlias = (Tiger) context.getBean("kitty", "Siberian");
|
|
||||||
assertEquals("Cutie", tiger.getName());
|
assertEquals("Siberian", tiger.getName());
|
||||||
assertEquals("Striped", tigerSecond.getName());
|
assertEquals("Striped", secondTiger.getName());
|
||||||
assertEquals("Siberian", tigerViaAlias.getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
Loading…
x
Reference in New Issue
Block a user