bael-4197: move source code to spring-boot-testing-2 module
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
package com.baeldung.xmlapplicationcontext;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
|
||||
@SpringBootApplication
|
||||
@ImportResource({"classpath*:application-context.xml"})
|
||||
public class XmlBeanApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(XmlBeanApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.baeldung.xmlapplicationcontext.domain;
|
||||
|
||||
public class Employee {
|
||||
|
||||
private String name;
|
||||
private String role;
|
||||
|
||||
public Employee() {
|
||||
|
||||
}
|
||||
|
||||
public Employee(String name, String role) {
|
||||
this.name = name;
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return this.role;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.baeldung.xmlapplicationcontext.service;
|
||||
|
||||
import com.baeldung.xmlapplicationcontext.domain.Employee;
|
||||
|
||||
public interface EmployeeService {
|
||||
|
||||
Employee getEmployee();
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.baeldung.xmlapplicationcontext.service;
|
||||
|
||||
import com.baeldung.xmlapplicationcontext.domain.Employee;
|
||||
|
||||
public class EmployeeServiceImpl implements EmployeeService {
|
||||
|
||||
@Override
|
||||
public Employee getEmployee() {
|
||||
return new Employee("Baeldung", "Admin");
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.baeldung.xmlapplicationcontext.service;
|
||||
|
||||
import com.baeldung.xmlapplicationcontext.domain.Employee;
|
||||
|
||||
public class EmployeeServiceTestImpl implements EmployeeService {
|
||||
|
||||
@Override
|
||||
public Employee getEmployee() {
|
||||
return new Employee("Baeldung-Test", "Admin");
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<bean id="employeeServiceImpl" class="com.baeldung.xmlapplicationcontext.service.EmployeeServiceImpl" />
|
||||
</beans>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<bean id="employeeServiceImpl" class="com.baeldung.xmlapplicationcontext.service.EmployeeServiceImpl" />
|
||||
</beans>
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.baeldung.xmlapplicationcontext;
|
||||
|
||||
import com.baeldung.xmlapplicationcontext.service.EmployeeService;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = XmlBeanApplication.class)
|
||||
//@ContextConfiguration(locations = "file:src/main/webapp/WEB-INF/application-context.xml")
|
||||
public class EmployeeServiceAppContextIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
private EmployeeService service;
|
||||
|
||||
@Test
|
||||
public void whenContextLoads_thenServiceISNotNull() {
|
||||
assertThat(service).isNotNull();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.baeldung.xmlapplicationcontext;
|
||||
|
||||
import com.baeldung.xmlapplicationcontext.service.EmployeeService;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = XmlBeanApplication.class)
|
||||
@ContextConfiguration(locations = "/test-context.xml")
|
||||
public class EmployeeServiceTestContextIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("employeeServiceTestImpl")
|
||||
private EmployeeService serviceTest;
|
||||
|
||||
@Test
|
||||
public void whenTestContextLoads_thenServiceTestISNotNull() {
|
||||
assertThat(serviceTest).isNotNull();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<bean id="employeeServiceTestImpl" class="com.baeldung.xmlapplicationcontext.service.EmployeeServiceTestImpl" />
|
||||
</beans>
|
||||
Reference in New Issue
Block a user