public void testEmptyFromAction() { String badCaseEmptyFromViewId = "<navigation-rule>" + "<description>Test Navigation Rule</description><display-name>MyNavigationCase</display-name>" + "<from-view-id> </from-view-id>" + "</navigation-rule>"; String facesConfig = Utilities.getFacesConfig(badCaseEmptyFromViewId); Node navigationRuleNode = Utilities.extractFirstNavigationRuleNode(facesConfig); NavigationRuleTestCase testCase = new NavigationRuleTestCase( "NavigationRuleTestCase_TestCase", CONFIG_FILE_PATH, navigationRuleNode); try { testCase.testFromViewId(); } catch (AssertionFailedError afe) { assertEquals("'from-view-id' must not be configured with empty content", afe.getMessage()); } }
public void testDuplicateFromViewId() { String badCaseDuplicateFromViewId = "<navigation-rule>" + "<description>Test Navigation Rule</description><display-name>MyNavigationRule</display-name>" + "<from-view-id>/pages/myFromView1.jsp</from-view-id>" + "<from-view-id>/pages/myFromView2.jsp</from-view-id>" + "</navigation-rule>"; String facesConfig = Utilities.getFacesConfig(badCaseDuplicateFromViewId); Node navigationRuleNode = Utilities.extractFirstNavigationRuleNode(facesConfig); NavigationRuleTestCase testCase = new NavigationRuleTestCase( "NavigationRuleTestCase_TestCase", CONFIG_FILE_PATH, navigationRuleNode); try { testCase.testFromViewId(); } catch (AssertionFailedError afe) { assertEquals( "'from-view-id' must not be configured more than once for a 'navigation-rule'", afe.getMessage()); } }