Skip to content

Instantly share code, notes, and snippets.

@ajduke
Created August 14, 2013 09:43
Show Gist options
  • Save ajduke/6229479 to your computer and use it in GitHub Desktop.
Save ajduke/6229479 to your computer and use it in GitHub Desktop.
Using Junit4
package test;
import java.util.concurrent.TimeUnit;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
public class TestClass {
@Ignore
@Before
public void before() {
System.out.println("before...");
}
@BeforeClass
public static void beforeClass() {
System.out.println("beforeClass...");
}
@Test
public void testCalcOne() {
System.out.println("TestOne..");
}
// @Ignore
@Test(expected = IllegalArgumentException.class, timeout = 5000)
public void testCalc() throws InterruptedException {
System.out.println("Test..");
TimeUnit.SECONDS.sleep(10);
throw new IllegalArgumentException();
}
@After
public void after() {
System.out.println("after...");
}
@AfterClass
public static void afterClass() {
System.out.println("afterClass..");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment