Skip to content

Instantly share code, notes, and snippets.

@toagit
Created April 23, 2015 05:59
Show Gist options
  • Save toagit/cf0c0b05c8112b54d3cf to your computer and use it in GitHub Desktop.
Save toagit/cf0c0b05c8112b54d3cf to your computer and use it in GitHub Desktop.
JUnit3
// 正常系
// 例外はcatchしないことで、JUnit側でStackTraceはかせる
public void testOK() throws Exception {
}
// 異常系
// 検証対象の例外を検証する
public void testException() throws Exception {
try {
fail();
} catch (Exception e) {
assertTrue(e instaceof myException)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment