@Test public void test_order() { Collection<Section> sections = asList( newSection("end2"), newSection("bar"), newSection("end1"), newSection("foo")); List<String> ordered = SystemInfoUtils.order(sections, "foo", "bar").stream() .map(Section::getName) .collect(Collectors.toList()); assertThat(ordered).isEqualTo(asList("foo", "bar", "end1", "end2")); }