### Question:
MonacoEditorWidget extends TextBoxBase { @Override public String getValue() { return getCodeEditor() .map(editor -> editor.getValue()) .orElse(""); } MonacoEditorWidget(); void setCodeEditor(final MonacoStandaloneCodeEditor codeEditor); void setValue(final String value); @Override String getValue(); @Override void setFocus(final boolean focused); Optional<MonacoStandaloneCodeEditor> getCodeEditor(); @Override void setTabIndex(final int index);  }### Answer:
@Test public void testGetValueWhenCodeEditorIsPresent() { final String expectedValue = "value"; when(codeEditor.getValue()).thenReturn(expectedValue); final String actualValue = widget.getValue(); assertEquals(expectedValue, actualValue); }