@Test public void removeWrapperWithInternalNewLinesTest() { String json = "\n" + "{\n" + "'json':'content',\n" + "'here':true\n" + "}\n"; String noActual = "updateCenter.post(" + json + ");"; String result = PluginManagerUtils.removePossibleWrapperText(noActual); assertThat(result).isEqualTo(json); new JSONObject(result); }
public static String removePossibleWrapperText(String urlText) { if (urlText != null && urlText.startsWith("updateCenter.post(")) { Pattern pattern = Pattern.compile("updateCenter.post\\((.*)\\);", Pattern.DOTALL); Matcher matcher = pattern.matcher(urlText); if (matcher.find()) { return matcher.group(1); } } return urlText; }
PluginManagerUtils { public static String removePossibleWrapperText(String urlText) { if (urlText != null && urlText.startsWith("updateCenter.post(")) { Pattern pattern = Pattern.compile("updateCenter.post\\((.*)\\);", Pattern.DOTALL); Matcher matcher = pattern.matcher(urlText); if (matcher.find()) { return matcher.group(1); } } return urlText; } }
PluginManagerUtils { public static String removePossibleWrapperText(String urlText) { if (urlText != null && urlText.startsWith("updateCenter.post(")) { Pattern pattern = Pattern.compile("updateCenter.post\\((.*)\\);", Pattern.DOTALL); Matcher matcher = pattern.matcher(urlText); if (matcher.find()) { return matcher.group(1); } } return urlText; } private  PluginManagerUtils(); }
PluginManagerUtils { public static String removePossibleWrapperText(String urlText) { if (urlText != null && urlText.startsWith("updateCenter.post(")) { Pattern pattern = Pattern.compile("updateCenter.post\\((.*)\\);", Pattern.DOTALL); Matcher matcher = pattern.matcher(urlText); if (matcher.find()) { return matcher.group(1); } } return urlText; } private  PluginManagerUtils(); static String appendPathOntoUrl(Object urlString, Object... pathSection); static String appendPathOntoUrl(String urlString, String... pathSection); static String removePossibleWrapperText(String urlText); static String dirName(Object urlString); static String dirName(String urlString); static String removePath(Object urlString); static String removePath(String urlString); }
PluginManagerUtils { public static String removePossibleWrapperText(String urlText) { if (urlText != null && urlText.startsWith("updateCenter.post(")) { Pattern pattern = Pattern.compile("updateCenter.post\\((.*)\\);", Pattern.DOTALL); Matcher matcher = pattern.matcher(urlText); if (matcher.find()) { return matcher.group(1); } } return urlText; } private  PluginManagerUtils(); static String appendPathOntoUrl(Object urlString, Object... pathSection); static String appendPathOntoUrl(String urlString, String... pathSection); static String removePossibleWrapperText(String urlText); static String dirName(Object urlString); static String dirName(String urlString); static String removePath(Object urlString); static String removePath(String urlString);  }