void (ContentEntry e, final List<? extends ContentFolder> folders, String... expected) { List<String> actual = new ArrayList<>(); for (ContentFolder f : folders) { String rootUrl = e.getUrl(); String folderUrl = f.getUrl(); if (folderUrl.startsWith(rootUrl)) { int length = rootUrl.length() + 1; folderUrl = folderUrl.substring(Math.min(length, folderUrl.length())); } actual.add(folderUrl); } assertOrderedElementsAreEqual(actual, Arrays.asList(expected)); }