use of com.google.template.soy.error.SoyErrorKind in project closure-templates by google.
the class SoyConformanceTest method getViolations.
private ImmutableList<SoyError> getViolations(String textProto, SoyFileSetParserBuilder builder) {
ValidatedConformanceConfig config = parseConfigProto(textProto);
ErrorReporter errorReporter = ErrorReporter.createForTest();
builder.setConformanceConfig(config).errorReporter(errorReporter).parse();
ImmutableList<SoyError> errors = errorReporter.getErrors();
Set<SoyErrorKind> expectedErrorKinds = new HashSet<>();
for (RuleWithWhitelists rule : config.getRules()) {
expectedErrorKinds.add(rule.getRule().error);
}
for (SoyError actualError : errors) {
if (!expectedErrorKinds.contains(actualError.errorKind())) {
throw new AssertionError("Found non-conformance error!: " + actualError + "\nexpected kind to be one of: " + expectedErrorKinds + " actual is: " + actualError.errorKind());
}
}
return errors;
}
Aggregations