ViewShowControlAreaAction extends ContextAwareAction { @Override public void actionPerformed(ActionEvent e) { MCTHousing housing = getHousing(); if (housing == null) { return; } boolean currentControlVisibilityState = housing.isControlAreaVisible(); housing.setControlAreaVisible(!currentControlVisibilityState); housing.toggleControlAreas(!currentControlVisibilityState); } ViewShowControlAreaAction(); @Override void actionPerformed(ActionEvent e); @Override boolean canHandle(ActionContext context); @Override boolean isEnabled();  }
@Test(dependsOnMethods = { "testCanHandle" }) public void testActionPerformed() { assertFalse(testHousing.isControlAreaVisible()); viewShow.actionPerformed(null); assertTrue(testHousing.isControlAreaVisible()); viewShow.actionPerformed(null); assertFalse(testHousing.isControlAreaVisible()); }
@Test (dependsOnMethods = { "testActionPerformed" }) public void testNullHousing() { viewShow.setTestHousing(null); viewShow.actionPerformed(null); }