DataTransferScreen { public void doExport() { callExportService(DataTransferExportModel.exportAll()); } 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 doExportTest() throws Exception { String path = "path"; DataTransferExportModel exportAll = DataTransferExportModel.exportAll(); when(dataTransferServices.doExport(exportAll)).thenReturn(path); dataTransferScreen.init(); dataTransferScreen.doExport(); verify(dataTransferServices).doExport(exportAll); verify(view).exportOK(); verify(view).download(path); }
@Test public void doExportFailureTest() throws Exception { IOException exception = new IOException(); DataTransferExportModel exportAll = DataTransferExportModel.exportAll(); when(dataTransferServices.doExport(exportAll)).thenThrow(exception); dataTransferScreen.doExport(); verify(dataTransferServices).doExport(exportAll); verify(view).exportError(exception); }