Spoiler
Hello,
we are migrating from Java SDK API V1 to Java SDK V2 and I am writing some integration tests.
For example, after I delete a file I need to check, that this file is no longer present on Drobpox or after upload I need to check, that file is there. What is the recommended way, how to do that?
My current ****** workaround is this:
private boolean fileExistsOnDbx(String dropboxPath, DbxClientWrapper dbxClientWrapper) throws DbxException {
try{
dbxClientWrapper.files().getMetadata(dropboxPath);
return true;
}catch (GetMetadataErrorException e){
if (e.getMessage().contains("{\".tag\":\"path\",\"path\":\"not_found\"}")) {
return false;
} else {
throw e;
}
}
}
Thank you,
Michal