Skip to content

Instantly share code, notes, and snippets.

@weikangchia
Last active April 17, 2022 13:33
Show Gist options
  • Save weikangchia/67682a85f4fb7fe4e7b4feb137124eb3 to your computer and use it in GitHub Desktop.
Save weikangchia/67682a85f4fb7fe4e7b4feb137124eb3 to your computer and use it in GitHub Desktop.
import org.junit.Test;
public class JUnit4Test {
@Test(expected = RuntimeException.class)
public void shouldThrowRuntimeException() {
throw new RuntimeException("Exception met");
}
@Test(timeout = 1)
public void shouldTimeoutAfter1Milliseconds() throws InterruptedException {
Thread.sleep(500);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment