// STEP 2:
// 2.1:Verify the CONTROLLERDEF object
assertTrue(controller instanceof JavascriptControllerDef);
// Convert from a generic controller to a Javascript type controller
JavascriptControllerDef obj = (JavascriptControllerDef) controller;
// Step 4: Verify properties of JavascriptRenderDef Object
// OBject that is to be verified: Qualified name,
assertEquals("unexpected qualifiedName of controller",
"js://test.testJSController", obj.getDescriptor()
.getQualifiedName());
serializeAndGoldFile(controller, "_JSControllerDef");
// 2.2: Should be able to create an instance of the client action on
// the server side, but it's a pseudo action
try {
obj.createAction("newAction", new HashMap<String, Object>());
fail("Should not be able to create an instance of the client action on the server side");
} catch (Exception e) {// Expect a definition not found Exception
checkExceptionFull(e, DefinitionNotFoundException.class,
"No ACTION named js://test.testJSController/ACTION$newAction found");
}
JavascriptPseudoAction action = (JavascriptPseudoAction) obj.createAction("functionName1", null);
assertEquals(State.ERROR, action.getState());
// 2.3 Extract the action defs and verify each of them in Step 3
// Get all the actions defined in the Javascript
Map<String, JavascriptActionDef> controllerActions = obj
.getActionDefs();
// STEP 3:
// 3.1: Verify the number of ACTIONDEF objects is 2
assertTrue(controllerActions.size() == 2);