hr.fer.junit.grading.GradingReport Maven / Gradle / Ivy
Show all versions of junit-grading Show documentation
package hr.fer.junit.grading;
import java.io.PrintWriter;
import java.io.Writer;
/**
* Grading report
*/
public interface GradingReport {
int getTotalPercent();
/**
* Print summary to the supplied {@link PrintWriter}.
*
* This method does not print failure messages.
*
*/
void printSummaryTo(Writer writer);
/**
* Print failed containers and tests, including sources and exception
* messages, to the supplied {@link PrintWriter}.
*
* @param writer the {@code PrintWriter} to which to print; never {@code null}
*/
void printDetailedSummaryTo(Writer writer);
/**
* Print statistics table (testGroup, number of tests, test id).
* @param writer the {@code PrintWriter} to which to print; never {@code null}
*/
void printStatisticsTo(Writer writer);
/**
* Returns if tests/container is passing
* @return status
*/
boolean isPassing();
/**
* Returns precondition failure.
* @return failure text
*/
String getPreconditionFailure();
static GradingReport createNull(int percent, boolean isPassing) {
return new GradingReport() {
@Override
public int getTotalPercent() {
return percent;
}
@Override
public void printSummaryTo(Writer writer) {
}
@Override
public void printDetailedSummaryTo(Writer writer) {
}
@Override
public void printStatisticsTo(Writer writer) {
}
@Override
public boolean isPassing() {
return isPassing;
}
@Override
public String getPreconditionFailure() {
return null;
}
};
}
}