1 19 20 package org.netbeans.modules.j2ee.ejbfreeform; 21 22 import java.util.ArrayList ; 23 import java.util.Arrays ; 24 import java.util.Collections ; 25 import java.util.List ; 26 import junit.framework.TestCase; 27 import junit.framework.*; 28 import org.netbeans.spi.project.ActionProvider; 29 import org.openide.util.Lookup; 30 31 35 public class EjbFreeFormActionProviderTest extends TestBase { 36 37 public EjbFreeFormActionProviderTest(String testName) { 38 super(testName); 39 } 40 41 protected void setUp() throws Exception { 42 super.setUp(); 43 super.setUpProject(); 44 } 45 46 protected void tearDown() throws Exception { 47 } 48 49 public void testGetSupportedActions() { 50 ActionProvider ap = (ActionProvider)ejbFF.getLookup().lookup(ActionProvider.class); 51 assertNotNull("have an action provider", ap); 52 List actionNames = new ArrayList (Arrays.asList(ap.getSupportedActions())); 53 Collections.sort(actionNames); 54 assertEquals("right action names", Arrays.asList(new String [] {"build", "clean", "compile.single", "copy", "debug", "delete", "deploy", "javadoc", "move", "rebuild", "redeploy", "rename", "run", "test"}), actionNames); 55 assertTrue("clean is enabled", ap.isActionEnabled("clean", Lookup.EMPTY)); 56 try { 57 ap.isActionEnabled("frobnitz", Lookup.EMPTY); 58 fail("Should throw IAE for unrecognized commands"); 59 } catch (IllegalArgumentException e) { 60 } 62 try { 63 ap.invokeAction("goetterdaemmerung", Lookup.EMPTY); 64 fail("Should throw IAE for unrecognized commands"); 65 } catch (IllegalArgumentException e) { 66 } 68 } 71 72 } 73 | Popular Tags |