I received an email from Dropbox states from middle of october get temporary links api will returns an email_not_verified error in case user not verified her email address, so far so good. I'm able to get the response body from the doc https://www.dropbox.com/developers/documentation/http/documentation#files-get_temporary_link Since I'm using dropbox java sdk and I'm used to code test first, I was trying to simulate the scenario, but having the json inside the http response, I've an error parsing the json inside dbx library. So I tried changing the status code and, having 409 I got com.dropbox.core.v2.files.GetTemporaryLinkErrorException: Exception in 2/files/get_temporary_link: "other"
but it is not enough, since I need to manage the scenario.. Can someone help me understanding what I can check in the code but first of all, what is the response I've to simulate in my unit test?
Thanks in advance
The other
error case indicates that it's an error that the SDK you're using does not recognize. The GetTemporaryLinkError.email_not_verified
error is relatively new, so you'll need to make sure you're using a recent enough version of the SDK to be able to identify it. For the GetTemporaryLinkError.email_not_verified
error, that is v3.1.0 or later of the Dropbox Java SDK. (It's best to just get the latest anyway, which is currently v3.1.1.)
If you're are using an updated version of the SDK, it's also possible you're just not setting valid JSON for the GetTemporaryLinkError.email_not_verified
error case when you're trying to simulate this. You can find the valid JSON for this error case in the /2/files/get_temporary_link documentation. Make sure you copy that as shown there if you're trying to simulate this.
Lastly, to actually catch that error with the Dropbox Java SDK, you'll want to catch GetTemporaryLinkErrorException
thrown by getTemporaryLink
. To check for the specific case, check the GetTemporaryLinkErrorException.errorValue
. The GetTemporaryLinkError.isEmailNotVerified
will return true
for the unverified email case.