### Question:
DRDNameChangerView implements DRDNameChanger { @EventHandler("drdNameInput") void onInputTextKeyPress(final KeyDownEvent event) { if (event.getNativeEvent().getKeyCode() == 13) { saveForTheCurrentDiagram(); } } @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 testOnInputTextKeyPress() { final NativeEvent nativeEvent = mock(NativeEvent.class); when(keyDownEvent.getNativeEvent()).thenReturn(nativeEvent); when(nativeEvent.getKeyCode()).thenReturn(13); drdNameChangerView.onInputTextKeyPress(keyDownEvent); verify(dmnDiagramsSession, times(1)).getCurrentDMNDiagramElement(); }