private String verifyJsonBody(Object jsonBody) { String s = null == jsonBody ? "" : (jsonBody instanceof String) ? (String) jsonBody : JSON.toJSONString(jsonBody); if (S.blank(s)) { return ""; } final String origin = s; if (s.startsWith("resource:")) { s = S.ensure(s.substring(9).trim()).startWith("/"); URL url = Act.getResource(s); E.unexpectedIf(null == url, "Cannot find JSON body: " + origin); s = IO.read(url).toString(); } try { JSON.parse(s); } catch (Exception e) { E.unexpected(e, "Invalid JSON body: " + origin); } return s; }
private String verifyJsonBody(Object jsonBody) { if (jsonBody instanceof Map) { processParamSubstitution((Map) jsonBody); } else if (jsonBody instanceof Collection) { jsonBody = processParamSubstitution((Collection) jsonBody); } String s = null == jsonBody ? "" : (jsonBody instanceof String) ? (String) jsonBody : JSON.toJSONString(jsonBody); if (S.blank(s)) { return ""; } final String origin = s; if (s.startsWith("resource:")) { s = S.ensure(s.substring(9).trim()).startWith("/"); URL url = Act.getResource(s); E.unexpectedIf(null == url, "Cannot find JSON body: " + origin); s = IO.read(url).toString(); } try { JSON.parse(s); } catch (Exception e) { E.unexpected(e, "Invalid JSON body: " + origin); } return s; }
String url = S.concat("http://localhost:", port, S.ensure(processStringSubstitution(requestSpec.url)).startWith("/")); boolean hasParams = !requestSpec.params.isEmpty(); if (hasParams) {
if (!reqUrl.startsWith("http")) { int portx = 0 != requestSpec.port ? requestSpec.port : port; url = S.concat("http://localhost:", portx, S.ensure(processStringSubstitution(reqUrl)).startWith("/")); } else { url = processStringSubstitution(reqUrl);
if (!reqUrl.startsWith("http")) { int portx = 0 != requestSpec.port ? requestSpec.port : port; url = S.concat("http://localhost:", portx, S.ensure(processStringSubstitution(reqUrl)).startWith("/")); } else { url = processStringSubstitution(reqUrl);
private String verifyJsonBody(Object jsonBody) { if (jsonBody instanceof Map) { processParamSubstitution((Map) jsonBody); } else if (jsonBody instanceof Collection) { jsonBody = processParamSubstitution((Collection) jsonBody); } String s = null == jsonBody ? "" : (jsonBody instanceof String) ? (String) jsonBody : JSON.toJSONString(jsonBody); if (S.blank(s)) { return ""; } final String origin = s; if (s.startsWith("resource:")) { s = S.ensure(s.substring(9).trim()).startWith("/"); URL url = Act.getResource(s); E.unexpectedIf(null == url, "Cannot find JSON body: " + origin); s = IO.read(url).toString(); } try { JSON.parse(s); } catch (Exception e) { E.unexpected(e, "Invalid JSON body: " + origin); } return s; }
private String patchResourceName(String name) { return S.ensure(name).startWith(fixtureFolder); }
protected String patchResourceName(String name) { return S.ensure(name).startWith(fixtureFolder); }
protected String patchResourceName(String name) { return S.ensure(name).startWith(fixtureFolder); }
protected void setFixtureFolder(String fixtureFolder) { if (S.notBlank(fixtureFolder)) { this.fixtureFolder = S.ensure(S.ensure(fixtureFolder.trim()).startWith("/")).endWith("/"); } }
protected void setFixtureFolder(String fixtureFolder) { if (S.notBlank(fixtureFolder)) { this.fixtureFolder = S.ensure(S.ensure(fixtureFolder.trim()).startWith("/")).endWith("/"); } }
protected void setFixtureFolder(String fixtureFolder) { if (S.notBlank(fixtureFolder)) { this.fixtureFolder = S.ensure(S.ensure(fixtureFolder.trim()).startWith("/")).endWith("/"); } }