- final ClassPathResource resource = new ClassPathResource(
- pathToResponseFiles + "passthrough-operational-example.json");
- try (InputStream inputStream = resource.getInputStream()) {
- final String string = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
- final ObjectMapper mapper = new ObjectMapper();
- responseObject = mapper.readValue(string, Object.class);
- } catch (final IOException exception) {
- log.error("Error reading the file.", exception);
+ try {
+ final Optional<Object> optionalResponseObject = getResponseObject(
+ "passthrough-operational-example.json", Object.class);
+ if (optionalResponseObject.isPresent()) {
+ responseObject = optionalResponseObject.get();
+ }
+
+ } catch (final IOException ioException) {
+ log.error("Error reading the file.", ioException);