All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.hsac.fitnesse.junit.reportmerge.writer.OverviewFileWriter Maven / Gradle / Ivy

There is a newer version: 5.3.17
Show newest version
package nl.hsac.fitnesse.junit.reportmerge.writer;

import nl.hsac.fitnesse.junit.reportmerge.TestReportHtml;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.List;

public abstract class OverviewFileWriter {
    private final File file;
    protected PrintWriter pw;

    public OverviewFileWriter(File parentDir, String name) {
        file = new File(parentDir, name);
    }

    public String write(List reports) throws IOException {
        pw = new PrintWriter(file, StandardCharsets.UTF_8.name());
        try {
            writeContent(reports);
        } finally {
            if (pw != null) {
                pw.flush();
                pw.close();
            }
        }
        return file.getAbsolutePath();
    }

    protected abstract void writeContent(List reports) throws IOException;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy