package at.gv.egiz.param_tests.serialization.html;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.gv.egiz.param_tests.serialization.TestSummaryWriter;
import at.gv.egiz.param_tests.testinfo.TestInfo;
import at.gv.egiz.param_tests.testinfo.TestVerdict;
/**
* Concrete implementation of the TestSummaryWriter
, which creates
* HTML output and uses the Twitter-bootstrap framework.
*
* @author mtappler
*
*/
public class HTMLTestSummaryWriter implements TestSummaryWriter {
/**
* the location of the test directory
*/
private String testDir;
/**
* the print writer which is used for writing
*/
private PrintWriter pw;
/**
* the logger for this class
*/
private static final Logger logger = LoggerFactory
.getLogger(HTMLTestSummaryWriter.class);
/**
* Constructor which sets the test directory.
*
* @param testDir
* location of the test directory
*/
public HTMLTestSummaryWriter(String testDir) {
this.testDir = testDir;
}
public void writeHeader() {
if (pw == null)
return;
pw.println("");
pw.println("");
pw.println("
Test name | "); pw.println("Test directory | "); pw.println("Test type | "); pw.println("Verdict | "); pw.println("
---|---|---|---|
%s | ", tInfo .getBaseTestData().getTestDirectory(), tInfo .getBaseTestData().getTestName())); pw.println(String.format("%s | ", tInfo.getBaseTestData() .getTestDirectory())); pw.println(String.format("%s | ", testType)); pw.println(String.format("%s | ", verdictToLabel(tInfo.getVerdict()))); pw.println("