@Test public void shouldReturnCustomMessage() { parserConfiguredFor(Lists.newArrayList(TestModelWithASingleAnnotatedMemberWithCustomMessageKey.class.getPackage() .getName()), emptyStringList()); String json = parser.parse(); String expected = "{" + LS + " \"" + TestModelWithASingleAnnotatedMemberWithCustomMessageKey.class.getSimpleName() + "\" : {" + LS + " \"notNullString\" : {" + LS + " \"required\" : {" + LS + " \"message\" : \"paul\"" + LS + " }" + LS + " }" + LS + " }" + LS + "}"; assertThat(json, is(expected)); }
public String parse() { Map<String, ClassConstraints> classNameToValidationRulesMap = new HashMap<>(); for (Class clazz : classpathScanner.findClassesToParse()) { if (clazz != null) { ClassConstraints classValidationRules = new AnnotatedClass(clazz, options.getExcludedFields(), allRelevantAnnotationClasses).extractValidationRules(); if (classValidationRules.size() > 0) { String name = options.getOutputFullTypeName() ? clazz.getName() : clazz.getSimpleName(); classNameToValidationRulesMap.put(name, classValidationRules); } } } return toJson(classNameToValidationRulesMap); }
ConstraintParser { public String parse() { Map<String, ClassConstraints> classNameToValidationRulesMap = new HashMap<>(); for (Class clazz : classpathScanner.findClassesToParse()) { if (clazz != null) { ClassConstraints classValidationRules = new AnnotatedClass(clazz, options.getExcludedFields(), allRelevantAnnotationClasses).extractValidationRules(); if (classValidationRules.size() > 0) { String name = options.getOutputFullTypeName() ? clazz.getName() : clazz.getSimpleName(); classNameToValidationRulesMap.put(name, classValidationRules); } } } return toJson(classNameToValidationRulesMap); } }
ConstraintParser { public String parse() { Map<String, ClassConstraints> classNameToValidationRulesMap = new HashMap<>(); for (Class clazz : classpathScanner.findClassesToParse()) { if (clazz != null) { ClassConstraints classValidationRules = new AnnotatedClass(clazz, options.getExcludedFields(), allRelevantAnnotationClasses).extractValidationRules(); if (classValidationRules.size() > 0) { String name = options.getOutputFullTypeName() ? clazz.getName() : clazz.getSimpleName(); classNameToValidationRulesMap.put(name, classValidationRules); } } } return toJson(classNameToValidationRulesMap); } ConstraintParser(Options options); }
ConstraintParser { public String parse() { Map<String, ClassConstraints> classNameToValidationRulesMap = new HashMap<>(); for (Class clazz : classpathScanner.findClassesToParse()) { if (clazz != null) { ClassConstraints classValidationRules = new AnnotatedClass(clazz, options.getExcludedFields(), allRelevantAnnotationClasses).extractValidationRules(); if (classValidationRules.size() > 0) { String name = options.getOutputFullTypeName() ? clazz.getName() : clazz.getSimpleName(); classNameToValidationRulesMap.put(name, classValidationRules); } } } return toJson(classNameToValidationRulesMap); } ConstraintParser(Options options); String parse(); }
ConstraintParser { public String parse() { Map<String, ClassConstraints> classNameToValidationRulesMap = new HashMap<>(); for (Class clazz : classpathScanner.findClassesToParse()) { if (clazz != null) { ClassConstraints classValidationRules = new AnnotatedClass(clazz, options.getExcludedFields(), allRelevantAnnotationClasses).extractValidationRules(); if (classValidationRules.size() > 0) { String name = options.getOutputFullTypeName() ? clazz.getName() : clazz.getSimpleName(); classNameToValidationRulesMap.put(name, classValidationRules); } } } return toJson(classNameToValidationRulesMap); } ConstraintParser(Options options); String parse();  }