1 19 package org.netbeans; 20 21 import org.fakepkg.FakeHandler; 22 import org.netbeans.junit.NbTestCase; 23 24 28 public class CLICanInfluenceMainClassTest extends NbTestCase { 29 private static boolean called; 30 31 public CLICanInfluenceMainClassTest(String testName) { 32 super(testName); 33 } 34 35 protected void setUp() throws Exception { 36 clearWorkDir(); 37 } 38 39 public static void main(String [] args) { 40 called = true; 41 } 42 43 public void testCLIChangesMainClass() throws Exception { 44 class R implements Runnable { 45 public void run() { 46 System.setProperty("netbeans.mainclass", CLICanInfluenceMainClassTest.class.getName()); 47 } 48 } 49 50 FakeHandler.toRun = new R(); 51 52 org.netbeans.MainImpl.main(new String [] { "--userdir", getWorkDirPath() }); 53 54 assertTrue("Our main method has been called", called); 55 } 56 } 57 | Popular Tags |