void (Map<String, String> graph, final String start, final String finish, final int k, String... expectedPaths) { Graph<String> generator = initGraph(graph); List<List<String>> paths = getAlgorithmsInstance().findKShortestPaths(generator, start, finish, k, new EmptyProgressIndicator(ModalityState.nonModal())); List<String> pathStrings = new ArrayList<>(); Set<Integer> sizes = new HashSet<>(); for (List<String> path : paths) { pathStrings.add(StringUtil.join(path, "")); sizes.add(path.size()); } if (sizes.size() != paths.size()) { UsefulTestCase.assertSameElements(pathStrings, expectedPaths); } else { UsefulTestCase.assertOrderedEquals(pathStrings, expectedPaths); } }