AnnotationList { List<AnnotationTriplet> getByAnnotation_OrderBy_OrderAscending(String annotation){ List<AnnotationTriplet> result = new ArrayList<>(); for (AnnotationTriplet a : list){ if (a.getAnnotation().equals(annotation)){ result.add(a); } } Collections.sort(result); return result; } AnnotationList(List<AnnotationTriplet> list);   }
@Test public void testGetByAnnotation_OrderBy_OrderAscending() throws Exception { AnnotationTriplet t0 = new AnnotationTriplet("value", 0, 0); AnnotationTriplet t1 = new AnnotationTriplet("value", 1, 1); AnnotationTriplet t2 = new AnnotationTriplet("deco", 2, 1); AnnotationTriplet t3 = new AnnotationTriplet("deco", 3, 2); AnnotationList list = new AnnotationList(Arrays.asList(t2, t1, t3, t0)); List<AnnotationTriplet> result = list.getByAnnotation_OrderBy_OrderAscending("value"); Assertions.assertThat(result.size()).isEqualTo(2); Assertions.assertThat(result.get(0)).isEqualTo(t0); Assertions.assertThat(result.get(1)).isEqualTo(t1); }