### Question:
ValidationGroupHelper { static List<String> getGroupsOnField(String groupsAsString) { List<String> classes = new ArrayList<>(); final String validationGroupsPrefix = "groups()={"; int indexOfGroups = groupsAsString.indexOf(validationGroupsPrefix); if (indexOfGroups == -1) { return Collections.emptyList(); } String tail = groupsAsString.substring(indexOfGroups); int indexOfClosingBrace = tail.indexOf("}"); classes = addClasses(classes, tail.substring(validationGroupsPrefix.length(), indexOfClosingBrace)); return classes; }  static boolean hasMatchingValidationGroup(String targetGroups, AnnotationMirror annotationMirror);  }### Answer:
@Test public void getSingleGroupOnField() { String input = "{groups()={com.a.A.class}}"; assertEquals(Arrays.asList("com.a.A"), ValidationGroupHelper.getGroupsOnField(input)); }
@Test public void getMultipleGroupsOnField() { String input = "{groups()={com.a.A.class, com.b.B.class}}"; assertEquals(Arrays.asList("com.a.A", "com.b.B"), ValidationGroupHelper.getGroupsOnField(input)); }
@Test public void getMultipleGroupsOnFieldWithOtherAttributes() { String input = "{names()={a,b},groups()={com.a.A.class, com.b.B.class},age()={12}}"; assertEquals(Arrays.asList("com.a.A", "com.b.B"), ValidationGroupHelper.getGroupsOnField(input)); }
@Test public void getNoGroupsOnFieldWithOtherAttributes() { String input = "{names()={a,b},age()={12}}"; assertEquals(Collections.emptyList(), ValidationGroupHelper.getGroupsOnField(input)); }