public void testSwitch() throws Exception {
HtmlPage page = renderView();
// System.out.println(page.asXml());
togglePanel.setValue("a");
togglePanel.broadcast(new SwitchablePanelSwitchEvent(togglePanel, null,
toggleControl));
assertFalse(((String) togglePanel.getValue()).equals("a"));
assertTrue(((String) togglePanel.getValue()).equals("b"));
toggleControl.setSwitchToState("a");
togglePanel.broadcast(new SwitchablePanelSwitchEvent(togglePanel,
"null", toggleControl));
assertFalse(((String) togglePanel.getValue()).equals("b"));
assertTrue(((String) togglePanel.getValue()).equals("a"));
toggleControl.setSwitchToState(null);
togglePanel.setStateOrder("c,b,a");
togglePanel.broadcast(new SwitchablePanelSwitchEvent(togglePanel,
"null", toggleControl));
assertFalse(((String) togglePanel.getValue()).equals("a"));
assertTrue(((String) togglePanel.getValue()).equals("c"));
togglePanel.setValue(null);
togglePanel.setStateOrder("c,b,a");
togglePanel.broadcast(new SwitchablePanelSwitchEvent(togglePanel,
"null", toggleControl));
assertTrue(((String) togglePanel.getValue()).equals("c"));
togglePanel.setStateOrder("");
toggleControl.setSwitchToState("d");
try {
togglePanel.broadcast(new SwitchablePanelSwitchEvent(togglePanel,
"null", toggleControl));
//fail();
} catch (Exception ex) {
}
}