사용자 도구

사이트 도구


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.1382345355.txt.gz · 마지막으로 수정됨: 2013/10/21 17:49 저자 kwon37xi