DataTransferScreen { public void doImport() { try { dataTransferServices.call( (RemoteCallback<List<String>>) imported -> { view.importOK(); popUp.show(imported); }, (ErrorCallback<Throwable>) (message, throwable) -> { view.importError(throwable); return false; }).doImport(); } catch (Exception e) { view.importError(e); } } DataTransferScreen(); @Inject  DataTransferScreen(
                              final View view,
                              final DataTransferPopUp popUp,
                              final Caller<DataTransferServices> dataTransferServices,
                              final ExportWizard exportWizard,
                              final BusyIndicatorView busyIndicatorView); @WorkbenchPartTitle String title(); @WorkbenchPartView View part(); @PostConstruct void init(); void doExport(); void doGradualExport(); void doImport(); String getFilePath(); String getExportFileName(); String getImportFileName(); static final String ID; }
@Test public void doImportTest() throws Exception { List<String> list = new ArrayList<>(); when(dataTransferServices.doImport()).thenReturn(list); dataTransferScreen.doImport(); verify(dataTransferServices).doImport(); verify(view).importOK(); verify(dataTransferPopUp).show(list); }
@Test public void doImportFailureTest() throws Exception { Exception exception = new Exception(); when(dataTransferServices.doImport()).thenThrow(exception); dataTransferScreen.doImport(); verify(dataTransferServices).doImport(); verify(view).importError(exception); }