Example usage for org.apache.commons.lang3.math Fraction toString

List of usage examples for org.apache.commons.lang3.math Fraction toString

Introduction

In this page you can find the example usage for org.apache.commons.lang3.math Fraction toString.

Prototype

String toString

To view the source code for org.apache.commons.lang3.math Fraction toString.

Click Source Link

Document

Cached output toString (class is immutable).

Usage

From source file:org.richfaces.tests.metamer.ftest.extension.attributes.coverage.saver.FullReportResultsSaver.java

protected void write(BufferedWriter bw) throws IOException {
    try {//w ww . j  a va 2  s .c o m
        int covered = 0, notCovered = 0;
        for (CoverageResult result : getResults()) {
            bw.append(result.getReport());
            bw.newLine();
            bw.flush();
            covered += result.getCovered().size() + result.getIgnored().size();
            notCovered += result.getNotCovered().size();
        }
        Fraction f = Fraction.getFraction(covered, covered + notCovered);
        bw.append("===========================================================");
        bw.newLine();
        bw.append("total coverage: ").append(f.toString()).append(" (")
                .append(String.valueOf((int) (f.doubleValue() * 100))).append("%)");
        bw.newLine();
        bw.flush();
    } finally {
        if (bw != null) {
            bw.close();
        }
    }
}