Last active
December 16, 2015 04:49
-
-
Save friek/5380022 to your computer and use it in GitHub Desktop.
Skip JUnit test conditionally
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
| import static org.junit.Assert.assertTrue; | |
| import static org.junit.Assume.assumeTrue; | |
| import org.junit.BeforeClass; | |
| import org.junit.Test; | |
| public class JunitSkipTest | |
| { | |
| @BeforeClass | |
| public static void setUpTest() | |
| { | |
| // This will make junit skip the test. | |
| assumeTrue(false); | |
| } | |
| @Test | |
| public void testSomething() | |
| { | |
| // Never reached, as the test got skipped. | |
| assertTrue(true != false); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment