Created
January 13, 2016 07:29
-
-
Save tuphamphuong/91e967429c730f6dd611 to your computer and use it in GitHub Desktop.
JUnit Enclosed test
This file contains 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 org.junit.Before; | |
import org.junit.Test; | |
import static org.junit.Assert.*; | |
import org.junit.experimental.runners.Enclosed; | |
import org.junit.runner.RunWith; | |
/** | |
* Created by Tu Pham Phuong - phamptu@gmail.com on 1/13/16. | |
*/ | |
@RunWith(Enclosed.class) | |
public class EnclosedTest { | |
abstract public static class SharedSetUp { | |
@Before | |
public void printSomething() { | |
System.out.println("Helllo"); | |
} | |
} | |
public static class FirstTest extends SharedSetUp { | |
@Test | |
public void assertThatSomethingIsTrue() { | |
System.out.println("assertThatSomethingIsTrue"); | |
assertEquals(true, true); | |
} | |
} | |
public static class SecondTest extends SharedSetUp { | |
@Test | |
public void assertThatSomethingIsFalse() { | |
System.out.println("assertThatSomethingIsFalse"); | |
assertEquals(false, false); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment