private HapiContext customContext;
@Override
protected void doPreSetup() throws Exception {
defaultValidationContext = ValidationContextFactory.defaultValidation();
defaultContext = new DefaultHapiContext(defaultValidationContext);
// we validate separately, not during parsing or rendering
defaultContext.getParserConfiguration().setValidating(false);
ValidationRuleBuilder builder = new ValidationRuleBuilder() {
@Override
protected void configure() {
forVersion(Version.V24)
.message("ADT", "A01")
.terser("PID-8", not(empty()));
}
};
customValidationContext = ValidationContextFactory.fromBuilder(builder);
customContext = new DefaultHapiContext(customValidationContext);
// we validate separately, not during parsing or rendering
customContext.getParserConfiguration().setValidating(false);
}