문서의 이전 판입니다!
@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); }
@Rule public TemporaryFolder folder = new TemporaryFolder(); // ... File createdFolder = folder.newFolder("newfolder"); File createdFile = folder.newFile("myfilefile.txt");