@Test void applyThrowsExceptionIfJsonPathDoesNotCompile() throws IOException { when(options.param(0)).thenReturn("$field"); assertThatThrownBy(() -> underTest.apply(JSON, options)) .isExactlyInstanceOf(TransformResponseException.class) .hasCauseInstanceOf(InvalidPathException.class); }
@Override public Object apply(String context, Options options) throws IOException { final String jsonPathString = options.param(0); try { return JsonPath.<String>read(context, jsonPathString); } catch (Exception e) { throw new TransformResponseException(format("Could not extract '%s' from '%s'", jsonPathString, context), e); } }
JsonPathHelper implements Helper<String> { @Override public Object apply(String context, Options options) throws IOException { final String jsonPathString = options.param(0); try { return JsonPath.<String>read(context, jsonPathString); } catch (Exception e) { throw new TransformResponseException(format("Could not extract '%s' from '%s'", jsonPathString, context), e); } } }
JsonPathHelper implements Helper<String> { @Override public Object apply(String context, Options options) throws IOException { final String jsonPathString = options.param(0); try { return JsonPath.<String>read(context, jsonPathString); } catch (Exception e) { throw new TransformResponseException(format("Could not extract '%s' from '%s'", jsonPathString, context), e); } }  }
JsonPathHelper implements Helper<String> { @Override public Object apply(String context, Options options) throws IOException { final String jsonPathString = options.param(0); try { return JsonPath.<String>read(context, jsonPathString); } catch (Exception e) { throw new TransformResponseException(format("Could not extract '%s' from '%s'", jsonPathString, context), e); } }  @Override Object apply(String context, Options options); }
JsonPathHelper implements Helper<String> { @Override public Object apply(String context, Options options) throws IOException { final String jsonPathString = options.param(0); try { return JsonPath.<String>read(context, jsonPathString); } catch (Exception e) { throw new TransformResponseException(format("Could not extract '%s' from '%s'", jsonPathString, context), e); } }  @Override Object apply(String context, Options options);  }