DataSetAwareSelect { public void onDataSetReady(@Observes DataSetReadyEvent event) { final FilterSettings filterSettings = event.getFilterSettings(); if (filterSettings.getServerTemplateId() == null || filterSettings.getServerTemplateId().isEmpty()) { removeOptions(); return; } if(dataSetLookup.getDataSetUUID().equals(event.getDataSetUUID())) { try { dataSetClientServices.lookupDataSet(ConsoleDataSetLookup.fromInstance(dataSetLookup, filterSettings.getServerTemplateId()), new DataSetReadyCallback() { @Override public void callback(final DataSet dataSet) { select.refresh(s -> { s.removeAllOptions(); for (int i = 0; i < dataSet.getRowCount(); i++) { final String text = (String) dataSet.getValueAt(i, textColumnId); final String value = (String) dataSet.getValueAt(i, valueColumnId); if (isNullOrEmpty(text) == false && isNullOrEmpty(value) == false) { s.addOption(text, value); } } if (s.getOptions().getLength() > 0) { s.enable(); } else { s.disable(); } }); } @Override public void notFound() { removeOptions(); errorPopup.showError(Constants.INSTANCE.DataSetNotFound(dataSetLookup.getDataSetUUID())); } @Override public boolean onError(ClientRuntimeError error) { removeOptions(); errorPopup.showError(Constants.INSTANCE.DataSetError(dataSetLookup.getDataSetUUID(), error.getMessage())); return false; } }); } catch (Exception ex) { new DefaultWorkbenchErrorCallback().error(ex); } } }  @PostConstruct void init(); void setDataSetLookup(DataSetLookup dataSetLookup); void setTextColumnId(String textColumnId); void setValueColumnId(String valueColumnId); void onDataSetReady(@Observes DataSetReadyEvent event); Select getSelect();  }
@Test public void testEmptyServerTemplate() { filterSettings.setKey("key"); dataSetAwareSelect.onDataSetReady(new DataSetReadyEvent(filterSettings, null)); verifyZeroInteractions(dataSetClientServices); verify(select).removeAllOptions(); }