Created
August 14, 2013 09:43
-
-
Save ajduke/6229479 to your computer and use it in GitHub Desktop.
Using Junit4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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