### Question:
DRDNameChangerView implements DRDNameChanger { void onSettingCurrentDMNDiagramElement(final @Observes DMNDiagramSelected selected) { if (dmnDiagramsSession.isGlobalGraphSelected()) { hideDRDNameChanger(); } else { this.drdName.setText(selected.getDiagramElement().getName().getValue()); editMode.getStyle().setDisplay(NONE); viewMode.getStyle().setDisplay(BLOCK); showDRDNameChanger(); } } @Inject  DRDNameChangerView(final DMNDiagramsSession dmnDiagramsSession, final Event<DMNDiagramSelected> selectedEvent, final DivElement viewMode, final DivElement editMode, final HTMLAnchorElement returnToDRG, final Span drdName, final InputElement drdNameInput); @Override void setSessionPresenterView(SessionPresenter.View sessionPresenterView); @Override void showDRDNameChanger(); @Override void hideDRDNameChanger();  }### Answer:
@Test public void testOnSettingCurrentDMNDiagramWhenIsGlobal() { when(dmnDiagramsSession.isGlobalGraphSelected()).thenReturn(true); drdNameChangerView.onSettingCurrentDMNDiagramElement(dmnDiagramSelected); verify(dmnDiagramsSession, times(2)).isGlobalGraphSelected(); }
@Test public void testOnSettingCurrentDMNDiagramWhenIsDRD() { when(dmnDiagramsSession.isGlobalGraphSelected()).thenReturn(false); when(dmnDiagramSelected.getDiagramElement()).thenReturn(dmnDiagramElement); when(dmnDiagramElement.getName()).thenReturn(new Name()); drdNameChangerView.onSettingCurrentDMNDiagramElement(dmnDiagramSelected); verify(dmnDiagramsSession, times(2)).isGlobalGraphSelected(); }