@Test public void testSetValueUsingCurrentLang() { tested.current = "lang1"; tested.setValue("lang1", "anotherValue"); assertEquals("lang1", tested.current); verify(view, never()).dispose(); verify(view, times(1)).setValue(eq("anotherValue")); }
public void setValue(String languageId, String value) { if (null != current && !current.equals(languageId)) { view.dispose(); current = null; } if (null == current) { getLanguageById(languageId).ifPresent(module -> load(module, value)); } else { view.setValue(value); } }
MonacoEditorPresenter { public void setValue(String languageId, String value) { if (null != current && !current.equals(languageId)) { view.dispose(); current = null; } if (null == current) { getLanguageById(languageId).ifPresent(module -> load(module, value)); } else { view.setValue(value); } } }
MonacoEditorPresenter { public void setValue(String languageId, String value) { if (null != current && !current.equals(languageId)) { view.dispose(); current = null; } if (null == current) { getLanguageById(languageId).ifPresent(module -> load(module, value)); } else { view.setValue(value); } } @Inject  MonacoEditorPresenter(MonacoEditorView view); }
MonacoEditorPresenter { public void setValue(String languageId, String value) { if (null != current && !current.equals(languageId)) { view.dispose(); current = null; } if (null == current) { getLanguageById(languageId).ifPresent(module -> load(module, value)); } else { view.setValue(value); } } @Inject  MonacoEditorPresenter(MonacoEditorView view); @PostConstruct void init(); MonacoEditorPresenter setOnChangeCallback(OnChangeCallback onChangeCallback); MonacoEditorPresenter setWidthPx(int widthPx); MonacoEditorPresenter setHeightPx(int heightPx); MonacoEditorPresenter setReadOnly(boolean readOnly); MonacoEditorPresenter addLanguage(MonacoEditorLanguage module); void setValue(String languageId, String value); String getValue(); String getLanguageId(); MonacoEditorView getView(); @PreDestroy void destroy(); }
MonacoEditorPresenter { public void setValue(String languageId, String value) { if (null != current && !current.equals(languageId)) { view.dispose(); current = null; } if (null == current) { getLanguageById(languageId).ifPresent(module -> load(module, value)); } else { view.setValue(value); } } @Inject  MonacoEditorPresenter(MonacoEditorView view); @PostConstruct void init(); MonacoEditorPresenter setOnChangeCallback(OnChangeCallback onChangeCallback); MonacoEditorPresenter setWidthPx(int widthPx); MonacoEditorPresenter setHeightPx(int heightPx); MonacoEditorPresenter setReadOnly(boolean readOnly); MonacoEditorPresenter addLanguage(MonacoEditorLanguage module); void setValue(String languageId, String value); String getValue(); String getLanguageId(); MonacoEditorView getView(); @PreDestroy void destroy();  }