Skip to content

Instantly share code, notes, and snippets.

@mehmetcemyucel
Last active April 4, 2021 09:02
Show Gist options
  • Save mehmetcemyucel/425230ee4b13048a97cf09cb1107740c to your computer and use it in GitHub Desktop.
Save mehmetcemyucel/425230ee4b13048a97cf09cb1107740c to your computer and use it in GitHub Desktop.
springboot-junit-rule
public class WithoutExpectedExceptionTest {
@Test(expected = NullPointerException.class)
public void test() {
String value = null;
value.split("");
}
@Test(expected = ArithmeticException.class)
public void test2() {
int val1 = 3, val2 = 0;
val1 = val1 / val2;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment