use of com.dropbox.core.v2.files.GetMetadataError in project dropbox-sdk-java by dropbox.
the class DbxClientV2IT method testError409.
@Test(expectedExceptions = { GetMetadataErrorException.class })
public void testError409() throws Exception {
DbxClientV2 client = ITUtil.newClientV2();
String path = ITUtil.path(getClass(), "/testError409/" + ITUtil.format(new Date()));
try {
client.files().getMetadata(path);
} catch (GetMetadataErrorException ex) {
assertNotNull(ex.getRequestId());
if (ex.getUserMessage() != null) {
assertNotNull(ex.getUserMessage().getLocale());
assertNotNull(ex.getUserMessage().getText());
assertNotNull(ex.getUserMessage().toString());
}
GetMetadataError err = ex.errorValue;
assertNotNull(err);
assertEquals(err.tag(), GetMetadataError.Tag.PATH);
assertTrue(err.isPath());
LookupError lookup = err.getPathValue();
assertNotNull(lookup);
assertEquals(lookup.tag(), LookupError.Tag.NOT_FOUND);
assertTrue(lookup.isNotFound());
assertFalse(lookup.isNotFile());
assertFalse(lookup.isOther());
assertFalse(lookup.isMalformedPath());
// raise so test can confirm an exception was thrown
throw ex;
}
}
Aggregations