Skip to content

Instantly share code, notes, and snippets.

@doohee323
Forked from HeartSaVioR/JUnitExceptionTest.java
Created November 12, 2013 16:41
Show Gist options
  • Select an option

  • Save doohee323/7434209 to your computer and use it in GitHub Desktop.

Select an option

Save doohee323/7434209 to your computer and use it in GitHub Desktop.
import org.junit.Test;
import org.junit.Rule;
import org.junit.rules.ExpectedException;
public class JUnitExceptionTest {
@Rule
public ExpectedException exception = ExpectedException.none();
@Test
public void testDoWork() {
exception.expect(IllegalStateException.class);
throw new IllegalStateException();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment