### Question:
FolderUtils { public static void checkSiblingNameConflicts(Folder folder) { if (folder.getFolders() != null && !folder.getFolders().isEmpty()) { Set<String> folderNames = new HashSet<>(); folder.getFolders().forEach(subFolder -> { if (!folderNames.add(subFolder.getNameAsString())) { throw new IllegalArgumentException("Duplicate folder name " + subFolder.getNameAsString()); } else { checkSiblingNameConflicts(subFolder); } }); } } private  FolderUtils(); static I_FolderAccess getPath(I_FolderAccess folderAccess, int currentIndex, String[] path); static void updateFolder(Folder update, I_FolderAccess target); static void checkSiblingNameConflicts(Folder folder); static UUID extractUuidFromObjectVersionId(ObjectVersionId folderId); static Integer extractVersionNumberFromObjectVersionId(ObjectVersionId objectVersionId); static ItemStructure parseFromJSONB(JSONB dbObject); static ItemStructure parseFromPGobject(PGobject databaseObject);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void detectsDuplicateFolderNames() throws IOException { String value = IOUtils.toString(FolderTestDataCanonicalJson.FOLDER_WITH_DUPLICATE_NAMES.getStream(), UTF_8); Folder testFolder = canonicalJson.unmarshal(value, Folder.class); FolderUtils.checkSiblingNameConflicts(testFolder); }
@Test public void acceptsFoldersWithoutConflicts() throws IOException { String value = IOUtils.toString(FolderTestDataCanonicalJson.FOLDER_WITHOUT_DUPLICATE_NAMES.getStream(), UTF_8); Folder testFolder = canonicalJson.unmarshal(value, Folder.class); FolderUtils.checkSiblingNameConflicts(testFolder); }