ImportExportServiceImpl implements ImportExportService { @Override public <T extends AbstractScesimData> AbstractScesimModel<T> importScesimModel(ImportExportType type, Object raw, AbstractScesimModel<T> originalScesimModel) { try { switch (type) { case CSV: return scenarioCsvImportExport.importData((String) raw, originalScesimModel); 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 importScesimModel() throws IOException { String raw = ""; importExportService.importScesimModel(ImportExportType.CSV, raw, simulationMock); verify(scenarioCsvImportExportMock, times(1)).importData(eq(raw), eq(simulationMock)); when(scenarioCsvImportExportMock.importData(anyString(), any())).thenThrow(new IllegalStateException()); assertThatThrownBy(() -> importExportService .importScesimModel(ImportExportType.CSV, raw, simulationMock)) .isInstanceOf(GenericPortableException.class); }