사용자 도구

사이트 도구


java:junit

문서의 이전 판입니다!


JUnit

읽어 볼 글

Exception Rule

  • 예외 발생 여부와 발생한 예외 종류를 검증할 수 있는 Rule
  @Rule
  public ExpectedException exception = ExpectedException.none();
 
  @Test
  public void throwsIllegalArgumentExceptionIfIconIsNull() {
    exception.expect(IllegalArgumentException.class);
    exception.expectMessage("Negative value not allowed");
    ClassToBeTested t = new ClassToBeTested();
    t.methodToBeTest(-1);
  }
java/junit.1382345087.txt.gz · 마지막으로 수정됨: 2013/10/21 17:44 저자 kwon37xi