ConstraintAndGroupDescriptionResolver implements
        ConstraintDescriptionResolver, GroupDescriptionResolver { @Override public List<Class<?>> getGroups(Constraint constraint) { Object rawGroups = constraint.getConfiguration().get(GROUPS); if (!(rawGroups instanceof Class[])) { return emptyList(); } Class<?>[] groups = (Class[]) rawGroups; List<Class<?>> result = new ArrayList<>(); Collections.addAll(result, groups); return result; } ConstraintAndGroupDescriptionResolver(ConstraintDescriptionResolver delegate, SnippetTranslationResolver translationResolver); @Override String resolveDescription(Constraint constraint); @Override List<Class<?>> getGroups(Constraint constraint); @Override String resolveGroupDescription(Class group, String constraintDescription);  }
@Test public void noGroupsResolved() { Constraint constraint = new Constraint("Constraint", Collections.<String, Object>emptyMap()); List<Class<?>> groups = resolver.getGroups(constraint); assertThat(groups).hasSize(0); }
@Test public void groupsResolved() { Map<String, Object> configuration = new HashMap<>(); configuration.put(GROUPS, new Class<?>[]{Update.class, Create.class}); Constraint constraint = new Constraint("Constraint", configuration); List<Class<?>> groups = resolver.getGroups(constraint); assertThat(groups).hasSize(2); assertThat(groups.get(0)).isEqualTo(Update.class); assertThat(groups.get(1)).isEqualTo(Create.class); }