/** *Anenumtoindicatetheexpectedsuccessorfailureofexecutingatask.
*/ publicenum Expect { /** It is expected that the task will complete successfully. */
SUCCESS, /** It is expected that the task will not complete successfully. */
FAIL
}
/** *Anenumtoidentifythestreamsthatmaybewrittenbya{@codeTask}.
*/ publicenum OutputKind { /** Identifies output written to {@code System.out} or {@code stdout}. */
STDOUT, /** Identifies output written to {@code System.err} or {@code stderr}. */
STDERR, /** Identifies output written to a stream provided directly to the task. */
DIRECT
};
/** *Theresultsfromrunninga{@linkTask}. *Theresultscontaintheexitcodereturnedwhenthetoolwasinvoked, *andamapcontainingtheoutputwrittentoanystreamsduringthe *executionofthetool. *Alltoolssupport"stdout"and"stderr". *ToolsthattakeanexplicitPrintWritersaveoutputwrittentothat *streamas"main".
*/ publicstaticclass Result { final ToolBox toolBox; final Task task; finalint exitCode; final Map<OutputKind, String> outputMap;
/** *Returnsthecontentofnamedstreamsasalistoflines. *@paramoutputKindsthekindsoftheselectedstreams *@returnthecontentthatwaswrittentothegivenstreamswhenthetool *wasexecuted.
*/ public List<String> getOutputLines(OutputKind... outputKinds) {
List<String> result = new ArrayList<>(); for (OutputKind outputKind : outputKinds) {
result.addAll(Arrays.asList(outputMap.get(outputKind).split(lineSeparator)));
} return result;
}
/** *Writesthecontentofthespecifiedstreamtothelog. *@paramkindthekindoftheselectedstream *@returnthisResultobject
*/ public Result write(OutputKind kind) {
PrintStream out = toolBox.out;
String text = getOutput(kind); if (text == null || text.isEmpty())
out.println("[" + task.name() + ":" + kind + "]: empty"); else {
out.println("[" + task.name() + ":" + kind + "]:");
out.print(text);
} returnthis;
}
/** *Writesthecontentofallstreamswithanycontenttothelog. *@returnthisResultobject
*/ public Result writeAll() {
PrintStream out = toolBox.out;
outputMap.forEach((name, text) -> { if (!text.isEmpty()) {
out.println("[" + name + "]:");
out.print(text);
}
}); returnthis;
}
}
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.10Bemerkung:
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.