use of com.google.api.tools.framework.model.BoundedDiagCollector in project toolkit by googleapis.
the class DiscoConfigBaselineTestCase method test.
/**
* Run a test for the given file base name(s). Collects all .proto and .yaml files with the given
* base name (i.e. baseName.proto or baseName.yaml), constructs model, and calls {@link #run()}.
* Post that, prints diags and the result of the run to the baseline.
*/
protected void test() throws Exception {
DiagCollector diagCollector = new BoundedDiagCollector();
// Run test specific logic.
Object result = run();
if (!diagCollector.hasErrors() && result != null) {
// Output the result depending on its type.
if (result instanceof Map) {
@SuppressWarnings("unchecked") Map<String, Object> map = (Map<String, Object>) result;
for (Map.Entry<String, Object> entry : map.entrySet()) {
testOutput().printf("============== file: %s ==============%n", entry.getKey());
testOutput().println(displayValue(entry.getValue()));
}
} else {
testOutput().println(displayValue(result));
}
}
}
Aggregations