일단 이거 참고
이클립스에 이 부분 기본 설정 후
http://memo.polypia.net/archives/557
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
public static workTest{ @Before public void before1(){ } @After public void after1(){ } @Test public void test1(){ Web web = new Web(); //이런게 있다고 치고.... x = web.getX(); //3이 나오면 성공 assertThat(x, is(3)); } @Test(expected=JDBCException.class) public void test2() throws Exception{ //JDBC익셉션이 발생하는 그코드 } } assertThat(x, is(3)); assertThat(x, is(not(3))); assertThat(responseString, either(containString));); assertThat(list, hasItem("3")); 대강 이정도면 다됨 @Rule이라는건 필요할 때가되면 |
스프링 설정
1 2 3 4 5 6 |
@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration( locations = { "classpath:spring-context.xml" } ) |