@Test void getDefaultData_error() { when(resourceLoader.getResource(anyString())).thenReturn(new ByteArrayResource("TEST".getBytes())); Optional<DataPayload> data = parseService.getDefaultData(); assertFalse(data.isPresent()); }
public Optional<DataPayload> getDefaultData() { try { return Optional.ofNullable(objectMapper.readValue(loadDefaultTemplate(), DataPayload.class)); } catch (IOException e) { log.error("Could not readout default NISP file template"); return Optional.empty(); } }
ParseService { public Optional<DataPayload> getDefaultData() { try { return Optional.ofNullable(objectMapper.readValue(loadDefaultTemplate(), DataPayload.class)); } catch (IOException e) { log.error("Could not readout default NISP file template"); return Optional.empty(); } } }
ParseService { public Optional<DataPayload> getDefaultData() { try { return Optional.ofNullable(objectMapper.readValue(loadDefaultTemplate(), DataPayload.class)); } catch (IOException e) { log.error("Could not readout default NISP file template"); return Optional.empty(); } }  }
ParseService { public Optional<DataPayload> getDefaultData() { try { return Optional.ofNullable(objectMapper.readValue(loadDefaultTemplate(), DataPayload.class)); } catch (IOException e) { log.error("Could not readout default NISP file template"); return Optional.empty(); } }  Optional<T> getDataFromFile(MultipartFile input, TypeReference<T> typeReference); Optional<DataPayload> getDefaultData(); byte[] generateFileByPayload(DataPayload data); List<T> convertFileToTargetObject(MultipartFile file, Class<T> target); }
ParseService { public Optional<DataPayload> getDefaultData() { try { return Optional.ofNullable(objectMapper.readValue(loadDefaultTemplate(), DataPayload.class)); } catch (IOException e) { log.error("Could not readout default NISP file template"); return Optional.empty(); } }  Optional<T> getDataFromFile(MultipartFile input, TypeReference<T> typeReference); Optional<DataPayload> getDefaultData(); byte[] generateFileByPayload(DataPayload data); List<T> convertFileToTargetObject(MultipartFile file, Class<T> target);  }