
de.codecentric.dwcaller.test.TestResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of data-weave-caller Show documentation
Show all versions of data-weave-caller Show documentation
Library to call DataWeave from Java and execute DW unit tests.
The newest version!
package de.codecentric.dwcaller.test;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Node in a tree with unit test results.
*/
public class TestResult {
private String name;
private int time;
private TestStatus status;
private String errorMessage;
private String text;
private String sourceIdentifier;
private Location start;
private Location end;
private List tests;
public TestResult() {
tests = new ArrayList<>();
name = "";
sourceIdentifier = "";
start = Location.UNKNOWN;
end = Location.UNKNOWN;
}
public TestResult(String name) {
this();
this.name = name;
}
public TestResult(String name, TestStatus status, String errorMessage) {
this(name);
this.status = status;
this.errorMessage = errorMessage;
}
/**
* Create an instance based on the code in data-weave-test-framework, file Tests.dwl.
* @param data JSON like data structure with test information.
*/
@SuppressWarnings("unchecked")
public TestResult(Map data) {
this();
name = (String) data.get("name");
time = (int) data.get("time");
status = TestStatus.valueOf((String) data.get("status"));
errorMessage = (String) data.get("errorMessage");
text = (String) data.get("text");
Map locationObject = (Map) data.get("location");
if (locationObject != null) {
start = new Location((Map) locationObject.get("start"));
end = new Location((Map) locationObject.get("end"));
sourceIdentifier = (String) locationObject.get("sourceIdentifier");
}
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy