### Question:
DMNGridLayer extends DefaultGridLayer { @Override public void deregister(final GridWidget gridWidget) { if (selectedGridWidget.isPresent()) { if (selectedGridWidget.get().equals(gridWidget)) { selectedGridWidget = Optional.empty(); } } super.deregister(gridWidget); }  void setDefaultTransformMediator(final TransformMediator defaultTransformMediator); @Override //This is overridden as Lienzo calls to draw() when the LienzoPanel is resized //which causes flickering of the 'ghosting' when an Expression type is selected //from the UndefinedExpressionGrid. Layer draw(); @Override Layer batch(); @Override TransformMediator getDefaultTransformMediator(); @Override void exitPinnedMode(final Command onCompleteCommand); @Override void updatePinnedContext(final GridWidget gridWidget); @Override void select(final GridWidget selectedGridWidget); @Override void deregister(final GridWidget gridWidget); @Override Layer removeAll();  }### Answer:
@Test public void testDeregister() { final GridWidget gridWidget = mock(GridWidget.class); gridLayer.select(gridWidget); gridLayer.deregister(expressionGrid); assertThat(gridLayer.getSelectedGridWidget().isPresent()).isTrue(); assertThat(gridLayer.getSelectedGridWidget().get()).isEqualTo(gridWidget); gridLayer.deregister(gridWidget); assertThat(gridLayer.getSelectedGridWidget().isPresent()).isFalse(); }