### Question:
QueryRegionStateController extends AbstractModuleStateController { @Override public boolean canActivateState(Node node) { try { return StateXML.newXPath().evaluate("/" + ModuleStateController.STATE_QNAME + "/:queryAreas", node, XPathConstants.NODE) != null; } catch (XPathExpressionException e) { LOGGER.error(e, e); return false; } } QueryRegionStateController(QueryRegionManager queryRegionManager, Toolbox toolbox); @Override synchronized void activateState(final String id, String description, Collection<? extends String> tags, Node node); @Override void activateState(String id, String description, Collection<? extends String> tags, StateType state); @Override boolean canActivateState(Node node); @Override boolean canActivateState(StateType state); @Override boolean canSaveState(); @Override synchronized void deactivateState(String id, Node node); @Override void deactivateState(String id, StateType state); @Override boolean isSaveStateByDefault(); @Override void saveState(Node node); @Override void saveState(StateType state);  }### Answer:
@Test public void testCanActivateState() throws XPathExpressionException, ParserConfigurationException { Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); QueryRegionStateController controller = new QueryRegionStateController(null, null); Assert.assertFalse(controller.canActivateState(doc)); doc.appendChild(StateXML.createElement(doc, ModuleStateController.STATE_NAME)) .appendChild(StateXML.createElement(doc, "queryAreas")); Assert.assertTrue(controller.canActivateState(doc)); }