ImportExportServiceImpl implements ImportExportService { @Override public Object exportScesimModel(ImportExportType type, AbstractScesimModel<? extends AbstractScesimData> scesimModel) { try { switch (type) { case CSV: return scenarioCsvImportExport.exportData(scesimModel); default: throw new IllegalArgumentException("Impossible to parse " + type); } } catch (Exception e) { throw ExceptionUtilities.handleException(e); } }  @Override Object exportScesimModel(ImportExportType type, AbstractScesimModel<? extends AbstractScesimData> scesimModel); @Override AbstractScesimModel<T> importScesimModel(ImportExportType type, Object raw, AbstractScesimModel<T> originalScesimModel);  }
@Test public void exportScesimModel() throws IOException { importExportService.exportScesimModel(ImportExportType.CSV, simulationMock); verify(scenarioCsvImportExportMock, times(1)).exportData(eq(simulationMock)); when(scenarioCsvImportExportMock.exportData(any())).thenThrow(new IllegalStateException()); assertThatThrownBy(() -> importExportService .exportScesimModel(ImportExportType.CSV, simulationMock)) .isInstanceOf(GenericPortableException.class); }