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

com.athaydes.rawhttp.reqinedit.js.JsTestReporter Maven / Gradle / Ivy

There is a newer version: 0.5.0
Show newest version
package com.athaydes.rawhttp.reqinedit.js;

import com.athaydes.rawhttp.reqinedit.HttpTestResult;
import com.athaydes.rawhttp.reqinedit.HttpTestsReporter;
import jdk.nashorn.api.scripting.ScriptObjectMirror;

@SuppressWarnings("unused") // used from the JS code
public final class JsTestReporter {
    private final HttpTestsReporter httpTestsReporter;

    public JsTestReporter(HttpTestsReporter httpTestsReporter) {
        this.httpTestsReporter = httpTestsReporter;
    }

    public void success(ScriptObjectMirror objectMirror) {
        long endTime = System.currentTimeMillis();
        httpTestsReporter.report(new HttpTestResult(
                (String) objectMirror.get("name"),
                (long) objectMirror.get("time"),
                endTime,
                null));
    }

    public void failure(ScriptObjectMirror objectMirror) {
        long endTime = System.currentTimeMillis();
        httpTestsReporter.report(new HttpTestResult(
                (String) objectMirror.get("name"),
                (long) objectMirror.get("time"),
                endTime,
                objectMirror.get("error").toString()));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy