+
+ public static String loadTextFile(String filePath) throws IOException {
+ FileReader fileReader = new FileReader(filePath);
+ BufferedReader bufReader = new BufferedReader(fileReader);
+
+ String line = null;
+ StringBuilder result = new StringBuilder();
+ while ((line = bufReader.readLine()) != null) {
+ result.append(line);
+ }
+ bufReader.close();
+ return result.toString();
+ }
+
+ private static Pattern patternForStringsSeparatedByWhiteChars(String... substrings) {
+ StringBuilder pattern = new StringBuilder();
+ pattern.append(".*");
+ for (String substring : substrings) {
+ pattern.append(substring);
+ pattern.append("\\s*");
+ }
+ pattern.append(".*");
+ return Pattern.compile(pattern.toString(), Pattern.DOTALL);
+ }
+
+ public static boolean containsStringData(String jsonOutput, String... substrings) {
+ Pattern pattern = patternForStringsSeparatedByWhiteChars(substrings);
+ Matcher matcher = pattern.matcher(jsonOutput);
+ return matcher.matches();
+ }