@Test
public void getMetadata() throws Exception {
mockServer.expect(requestTo(DropboxTemplate.METADATA_URL.replaceFirst("\\{appFolderUrl\\}", "dropbox").replaceFirst("\\{path\\}", ""))).andExpect(method(GET))
.andRespond(withResponse(jsonResource("/metadata"), responseHeaders));
Metadata metadata = dropbox.getItemMetadata("");
assertEquals("0881bfe7f09e0fe856cf9a27000ac00c", metadata.getHash());
assertEquals(false, metadata.isThumbExists());
assertEquals(0, metadata.getBytes());
assertEquals("/", metadata.getPath());
assertEquals(true, metadata.isDir());
assertEquals("0 bytes", metadata.getSize());
assertEquals("dropbox", metadata.getRoot());
assertEquals("folder", metadata.getIcon());
List<Metadata> contents = metadata.getContents();
assertEquals(9, contents.size());
Metadata folder = contents.get(0);
assertEquals("1202a9405f", folder.getRev());
assertEquals(false, folder.isThumbExists());
assertEquals(0, folder.getBytes());
assertEquals(fromDropboxDate("Wed, 08 Jun 2011 20:58:29 +0000"), folder.getModified());
assertEquals("/cv", folder.getPath());
assertEquals(true, folder.isDir());
assertEquals("0 bytes", folder.getSize());
assertEquals("dropbox", folder.getRoot());
assertEquals("folder", folder.getIcon());
Metadata file = contents.get(1);
assertEquals("702a9405f", file.getRev());
assertEquals(false, file.isThumbExists());
assertEquals(230783, file.getBytes());
assertEquals(fromDropboxDate("Thu, 05 May 2011 14:28:24 +0000"), file.getModified());
assertEquals("/Getting Started.pdf", file.getPath());
assertEquals(false, file.isDir());
assertEquals("225.4KB", file.getSize());
assertEquals("dropbox", file.getRoot());
assertEquals("page_white_acrobat", file.getIcon());
assertEquals("application/pdf", file.getMimeType());
}