@Test public void moveFilename_forExactFile_shouldGiveStringRename() { // Given // A simple file object FlatsyFlatFileDatabase db = new FlatsyFlatFileDatabase(root); FlatsyObject file = new FlatsyObject("test/test.json", db); // When // We rename the file itself using the files name as base String renamed = db.moveFilename(file, file.uri, "renamed/test.json"); // Then // We expect the file to be renamed assertEquals("renamed/test.json", renamed); }
@Test public void moveFilename_forSubFile_shouldGiveStringRename() { // Given // A simple file object FlatsyFlatFileDatabase db = new FlatsyFlatFileDatabase(root); FlatsyObject file = new FlatsyObject("sliced/red/tomatoes/test.json", db); String renameFrom = "sliced/red"; String renameTo = "fried/green"; // When // We rename the file itself using the files name as base String renamed = db.moveFilename(file, renameFrom, renameTo); // Then // We expect the file to be renamed assertEquals("fried/green/tomatoes/test.json", renamed); }