### Question:
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);  }### Answer:
@Test void getDefaultData() throws NoSuchFieldException { FieldSetter.setField(parseService, parseService.getClass().getDeclaredField("resourceLoader"), LOCAL_LOADER); Optional<DataPayload> data = parseService.getDefaultData(); assertTrue(data.isPresent()); }
@Test void getDefaultData_error() { when(resourceLoader.getResource(anyString())).thenReturn(new ByteArrayResource("TEST".getBytes())); Optional<DataPayload> data = parseService.getDefaultData(); assertFalse(data.isPresent()); }