Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Feb 22nd, 2012  |  syntax: Java  |  size: 0.25 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // I Junit 3:
  2. public void testMethod() {
  3.         Exception e = null;
  4.         try {
  5.                 doStuff();
  6.         } catch (Exception e_) {
  7.                 e = e_;
  8.         }
  9.         assertNotNull(e);
  10. }
  11.  
  12. // I JUnit 4:
  13. @Test(expected = SomeException.class)
  14. void testMethod() throws Exception {
  15.         doStuff();
  16. }