| 15 | import static org.junit.Assert.*; |
| 16 | |
| 17 | @RunWith(SpringJUnit4ClassRunner.class) |
| 18 | @ContextConfiguration(locations={"file:src/main/webapp/WEB-INF/spring/**/root-context.xml"}) |
| 19 | public class DBConnectionTest3 { |
| 20 | @Autowired |
| 21 | DataSource ds; // 컨테이너로부터 자동 주입받는다. |
| 22 | |
| 23 | @Test |
| 24 | public void jdbcConnectionTest() throws Exception { |
| 25 | // ApplicationContext ac = new GenericXmlApplicationContext("file:src/main/webapp/WEB-INF/spring/**/root-context.xml"); |
| 26 | // DataSource ds = ac.getBean(DataSource.class); |
| 27 | |
| 28 | Connection conn = ds.getConnection(); // 데이터베이스의 연결을 얻는다. |
| 29 | |
| 30 | System.out.println("conn = " + conn); |
| 31 | assertTrue(conn!=null); |
| 32 | } |
| 33 | } |
| 34 |
nothing calls this directly
no outgoing calls
no test coverage detected