bael-4197: add test class
This commit is contained in:
parent
232bd3080b
commit
58b01b624a
|
@ -0,0 +1,21 @@
|
|||
package com.baeldung.xmlapplicationcontext;
|
||||
|
||||
import com.baeldung.xmlapplicationcontext.service.EmployeeService;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@SpringBootTest(classes = XmlBeanApplication.class)
|
||||
public class EmployeeServiceAppContextIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
private EmployeeService service;
|
||||
|
||||
@Test
|
||||
public void whenContextLoads_thenServiceISNotNull() {
|
||||
assertThat(service).isNotNull();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.baeldung.xmlapplicationcontext;
|
||||
|
||||
import com.baeldung.xmlapplicationcontext.service.EmployeeService;
|
||||
import org.junit.Test;
|
||||
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 static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@SpringBootTest
|
||||
@ContextConfiguration(locations = "/test-context.xml")
|
||||
public class EmployeeServiceTestContextIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("employeeServiceTestImpl")
|
||||
private EmployeeService serviceTest;
|
||||
|
||||
@Test
|
||||
public void whenTestContextLoads_thenServiceTestISNotNull() {
|
||||
assertThat(serviceTest).isNotNull();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue