private Object toJsonObject() throws IOException { if (!(toBeVerified instanceof String)) { return toBeVerified; } String verifying = (String) toBeVerified; assertNotEmpty(verifying); return jsonToObject(verifying); } }
public static Object jsonToObject(String content) throws IOException { return content.trim().startsWith("[") ? jsonToList(content) : jsonToMap(content); }
public static Object toJSONAware(Object content) throws JsonProcessingException { if (content instanceof List) { return new JSONArray(toJsonString(content)); } else if (content instanceof Map) { return new JSONObject(toJsonString(content)); } else { return content; } }
private String fileContent(String fileName) throws IOException { return variables.interpret(read(configuration.classpathFile(fileName))); } }
@Given("^var: ([^\"' ]*)=code: ([^\"]*)$") public void defineVariableFromCodeInLine(String key, String code) throws ScriptException { variables.assign(key, eval(variables.interpret(code))); }
public static JsonContext json(Object content) { return new JsonContext(JsonPath.parse(content)); }
private Object toJsonObject() throws IOException { if (!(toBeVerified instanceof String)) { return toBeVerified; } String verifying = (String) toBeVerified; assertNotEmpty(verifying); return jsonToObject(verifying); } }
public static Object jsonToObject(String content) throws IOException { return content.trim().startsWith("[") ? jsonToList(content) : jsonToMap(content); }
public static Object toJSONAware(Object content) throws JsonProcessingException { if (content instanceof List) { return new JSONArray(toJsonString(content)); } else if (content instanceof Map) { return new JSONObject(toJsonString(content)); } else { return content; } }
@Given("^var: ([^\"' ]*)=code:$") public void defineVariableFromCodeBlock(String key, String code) throws ScriptException { variables.assign(key, eval(variables.interpret(code))); }
public static JsonContext json(Object content) { return new JsonContext(JsonPath.parse(content)); }
private String json(String jsonPath) { try { return toJsonString(verifying.json(jsonPath)); } catch (IOException e) { throw new RuntimeException(e); } } }
@Given("^var: ([^\"' ]*)=code: ([^\"]*)$") public void defineVariableFromCodeInLine(String key, String code) throws ScriptException { variables.assign(key, eval(variables.interpret(code))); }
private String json(String jsonPath) { try { return toJsonString(verifying.json(jsonPath)); } catch (IOException e) { throw new RuntimeException(e); } } }