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-core</module>
|
||||
<module>spring-core-2</module>
|
||||
<module>spring-cucumber</module>
|
||||
|
||||
<module>spring-data-rest</module>
|
||||
|
|
|
@ -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
|
||||
void whenGivenExistingBeanName_shouldReturnThatBean() {
|
||||
Object requestedBean = context.getBean("lion");
|
||||
Object lion = context.getBean("lion");
|
||||
|
||||
assertEquals(requestedBean.getClass(), Lion.class);
|
||||
assertEquals(lion.getClass(), Lion.class);
|
||||
}
|
||||
|
||||
@Test
|
|
@ -19,14 +19,20 @@ class GetBeanByNameWithConstructorParametersUnitTest {
|
|||
context = new AnnotationConfigApplicationContext(AnnotationConfig.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenGivenCorrectName_thenShouldReturnBeanWithSpecifiedName() {
|
||||
Tiger tiger = (Tiger) context.getBean("tiger", "Siberian");
|
||||
|
||||
assertEquals("Siberian", tiger.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenGivenCorrectNameOrAlias_shouldReturnBeanWithSpecifiedName() {
|
||||
Tiger tiger = (Tiger) context.getBean("tiger", "Cutie");
|
||||
Tiger tigerSecond = (Tiger) context.getBean("tiger", "Striped");
|
||||
Tiger tigerViaAlias = (Tiger) context.getBean("kitty", "Siberian");
|
||||
assertEquals("Cutie", tiger.getName());
|
||||
assertEquals("Striped", tigerSecond.getName());
|
||||
assertEquals("Siberian", tigerViaAlias.getName());
|
||||
Tiger tiger = (Tiger) context.getBean("tiger", "Siberian");
|
||||
Tiger secondTiger = (Tiger) context.getBean("tiger", "Striped");
|
||||
|
||||
assertEquals("Siberian", tiger.getName());
|
||||
assertEquals("Striped", secondTiger.getName());
|
||||
}
|
||||
|
||||
@Test
|
Loading…
Reference in New Issue