@Test public void shouldReturnEmptyJsonObjectWhenNoClassIsFound() { parserConfiguredFor(emptyStringList(), emptyStringList()); String json = parser.parse(); assertThat(json, is("{ }")); }
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();  }