1 19 20 package org.netbeans.modules.web.freeform; 21 22 import java.util.ArrayList ; 23 import java.util.Arrays ; 24 import java.util.Collections ; 25 import java.util.List ; 26 import org.netbeans.junit.NbTestCase; 27 import org.netbeans.spi.project.ActionProvider; 28 import org.openide.modules.ModuleInfo; 29 import org.openide.util.Lookup; 30 31 34 39 public class ActionsWebTest extends TestBaseWeb { 40 41 public ActionsWebTest (String name) { 42 super(name); 43 } 44 45 public void testBasicActions() throws Exception { 46 ActionProvider ap = (ActionProvider)jakarta.getLookup().lookup(ActionProvider.class); 47 assertNotNull("have an action provider", ap); 48 List actionNames = new ArrayList (Arrays.asList(ap.getSupportedActions())); 49 Collections.sort(actionNames); 50 assertEquals("right action names", Arrays.asList(new String [] {"build", "clean", "compile.single", "copy", "debug", "delete", "javadoc", "move", "rebuild", "redeploy", "rename", "run", "test"}), actionNames); 51 assertTrue("clean is enabled", ap.isActionEnabled("clean", Lookup.EMPTY)); 52 try { 53 ap.isActionEnabled("frobnitz", Lookup.EMPTY); 54 fail("Should throw IAE for unrecognized commands"); 55 } catch (IllegalArgumentException e) { 56 } 58 try { 59 ap.invokeAction("goetterdaemmerung", Lookup.EMPTY); 60 fail("Should throw IAE for unrecognized commands"); 61 } catch (IllegalArgumentException e) { 62 } 64 } 67 68 } 69 | Popular Tags |