JUnit BeforeClass
/* run: [java] JVM args ignored when same JVM is used. [java] @BeforeClass: set up onece [java] .@Before: set up [java] Time: 0.015 [java] OK (1 test) */ import java.util.ArrayList; import java.util.List; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import junit.framework.JUnit4TestAdapter; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; /** * Some simple tests. * */ public class MainClass{ public static void main (String... args) { junit.textui.TestRunner.run (suite()); } @BeforeClass public static void setUpOnce() { System.out.println("@BeforeClass: set up onece"); } @Before public void setUp() { System.out.println("@Before: set up "); } public static junit.framework.Test suite() { return new JUnit4TestAdapter(MainClass.class); } @Test public void testCopy() { assertTrue(1 == 1); } }