### Question:
XrayGogglesMenuProvider { public void close() { if (myCurrentController != null) { myCurrentController.close(); myCurrentController = null; } } XrayGogglesMenuProvider(Toolbox toolbox, XrayGogglesModel model); void close();  }### Answer:
@Test public void test() { EasyMockSupport support = new EasyMockSupport(); JMenu viewMenu = new JMenu("View"); UIRegistry uiRegistry = createUIRegistry(support, viewMenu); ScreenViewer viewer = createViewer(support); MapManager mapManager = createMapManager(support, viewer); GeometryRegistry geomRegistry = support.createNiceMock(GeometryRegistry.class); Toolbox toolbox = createToolbox(support, uiRegistry, mapManager, geomRegistry); support.replayAll(); XrayGogglesModel model = new XrayGogglesModel(); XrayGogglesMenuProvider provider = new XrayGogglesMenuProvider(toolbox, model); EventQueueUtilities.runOnEDTAndWait(() -> { }); JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem)viewMenu.getItem(0); assertEquals("Underground", menuItem.getText()); assertNull(model.getLowerLeft()); menuItem.doClick(); assertNotNull(model.getLowerLeft()); menuItem.doClick(); assertNull(model.getLowerLeft()); provider.close(); support.verifyAll(); }