@NotNull public static TestsOutput getTestsOutput( @NotNull final ProcessOutput processOutput, final boolean isAdaptive) { String congratulations = CONGRATULATIONS; final List<String> lines = processOutput.getStdoutLines(); for (int i = 0; i < lines.size(); i++) { final String line = lines.get(i); if (line.startsWith(STUDY_PREFIX)) { if (line.contains(TEST_OK)) { continue; } if (line.contains(CONGRATS_MESSAGE)) { congratulations = line.substring(line.indexOf(CONGRATS_MESSAGE) + CONGRATS_MESSAGE.length()); } if (line.contains(TEST_FAILED)) { if (!isAdaptive) { return new TestsOutput( false, line.substring(line.indexOf(TEST_FAILED) + TEST_FAILED.length())); } else { final StringBuilder builder = new StringBuilder( line.substring(line.indexOf(TEST_FAILED) + TEST_FAILED.length()) + "\n"); for (int j = i + 1; j < lines.size(); j++) { final String failedTextLine = lines.get(j); if (!failedTextLine.contains(STUDY_PREFIX) || !failedTextLine.contains(CONGRATS_MESSAGE)) { builder.append(failedTextLine); builder.append("\n"); } else { break; } } return new TestsOutput(false, builder.toString()); } } } } return new TestsOutput(true, congratulations); }
@NotNull public List<String> getOutputLines() { return myProcessOutput.getStdoutLines(); }