내 테스트 : 이것은 색소폰 이후의 것들에 밑줄을 긋는 부분입니다. 내가 try-catch 블록을 가지고 ....하지만 인터넷이 예외를 테스트 할 수있는 적절한 방법이 @Test(expected=IllegalArgumentException.class)
Java : Junit4 : 예외 테스트가 작동하지 않고 try-catch 블록을 고집합니다.
@Test(expected= XMLClientNotFoind.class)
public void testGetClientFromIP() throws XMLClientNotFound{
...
assertEquals(c, sax.getClientFromIP("101.0.2.01"));
}
그리고 방법이다 있다고 주장, getClientFromIP은 여기에 있습니다 :
public Client getClientFromIP(String ip) throws XMLClientNotFound {
...
throw new XMLClientNotFound();
}
그리고 내 예외 : 모든
public class XMLClientNotFound extends Exception{
}