use of org.finos.legend.engine.test.runner.mapping.RichMappingTestResult in project legend-sdlc by finos.
the class MappingTestCase method doRunTest.
@Override
protected void doRunTest() {
RichMappingTestResult richMappingTestResult = this.mappingTestRunner.doRunTest();
MappingTest mappingTest = this.mappingTestRunner.mappingTest;
if (richMappingTestResult.getResult() == TestResult.FAILURE) {
String message = "Test failure for mapping test '" + mappingTest.name + "' for Mapping '" + this.entity.getPath() + "'";
Optional<String> expected = richMappingTestResult.getExpected();
Optional<String> actual = richMappingTestResult.getActual();
if (expected.isPresent() || actual.isPresent()) {
assertEquals(message, expected.orElse(null), actual.orElse(null));
}
fail(message);
} else if (richMappingTestResult.getResult() == TestResult.ERROR) {
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter);
richMappingTestResult.getException().printStackTrace(printWriter);
String stackTraceString = stringWriter.toString();
fail("Error running mapping test '" + mappingTest.name + "' for Mapping '" + this.entity.getPath() + "' with error stack trace: \n" + stackTraceString + "\n");
}
}
Aggregations