File file = new File(folder, NetworkTestUtil.randomString());
FileUtils.writeStringToFile(file, NetworkTestUtil.randomString());
UseCaseTestUtil.uploadNewFile(client, file);
// store some things to be able to test later
UserProfile userProfileBeforeDeletion = UseCaseTestUtil.getUserProfile(client, userCredentials);
KeyPair metaKeyPairFolder = userProfileBeforeDeletion.getFileByPath(folder, root).getFileKeys();
KeyPair metaKeyPairFile = userProfileBeforeDeletion.getFileByPath(file, root).getFileKeys();
MetaFileSmall metaFileBeforeDeletion = (MetaFileSmall) UseCaseTestUtil.getMetaFile(client,
metaKeyPairFile);
Assert.assertNotNull(metaFileBeforeDeletion);
// delete the file
UseCaseTestUtil.deleteFile(client, file);
// check if the file is still in the DHT
UserProfile userProfile = UseCaseTestUtil.getUserProfile(client, userCredentials);
Assert.assertNull(userProfile.getFileById(metaKeyPairFile.getPublic()));
// check if the folder is still in the DHT
Assert.assertNotNull(userProfile.getFileById(metaKeyPairFolder.getPublic()));
// check the meta file is still in the DHT
MetaFile metaFile = UseCaseTestUtil.getMetaFile(client, metaKeyPairFile, false);
Assert.assertNull(metaFile);
}