public static <T> void sortLoadedClasses(List<T> loaded) {
        loaded.sort(CompareUtils::compareClassName);
    }
@Test
    public void testSort() throws Exception {
        //OverrideDetector is moved to index 0
        //by the private service loading in DefaultDetector.
        //This tests that a custom detector always comes first
        //and then reverse alphabetical order
        Detector[] detectors = new Detector[]{new MyCustomDetector(), new EmptyDetector(),
                new FileCommandDetector(), new OverrideDetector(), new ZeroSizeFileDetector()};
        List<Detector> expected = Arrays.asList(detectors);
        List<Detector> shuffled = new ArrayList<>(expected);
        Random random = new Random(42);
        for (int i = 0; i < 10; i++) {
            Collections.shuffle(shuffled, random);
            ServiceLoaderUtils.sortLoadedClasses(shuffled);
            assertEquals(expected, shuffled, "failed on iteration " + i);
        }
    }