コード例 #1
0
  @Test
  public void deleteNonexistingInodeTest() throws Exception {
    mThrown.expect(FileDoesNotExistException.class);
    mThrown.expectMessage("Inode id 1 does not exist");

    Inode testFile =
        new InodeFile.Builder()
            .setName("testFile1")
            .setId(1)
            .setParentId(1)
            .setPermissionStatus(TEST_PERMISSION_STATUS)
            .build();
    mTree.deleteInode(testFile);
  }
コード例 #2
0
  @Test
  public void deleteInodeTest() throws Exception {
    InodeTree.CreatePathResult createResult = mTree.createPath(NESTED_URI, sNestedDirectoryOptions);
    List<Inode> created = createResult.getCreated();

    // all inodes under root
    List<Inode> inodes = mTree.getInodeChildrenRecursive((InodeDirectory) mTree.getInodeById(0));
    // /nested, /nested/test
    Assert.assertEquals(2, inodes.size());
    // delete the nested inode
    mTree.deleteInode(created.get(created.size() - 1));
    inodes = mTree.getInodeChildrenRecursive((InodeDirectory) mTree.getInodeById(0));
    // only /nested left
    Assert.assertEquals(1, inodes.size());
  }