    @Test
    public void search() throws Exception {

        try {
            // Should be too short, and give an error
            api.search("/", "", 1000, false);
            assert false: "Short (empty) search string did not throw an error.";
        } catch (DropboxServerException e) {
            if (e.error != DropboxServerException._400_BAD_REQUEST) {
                assert false: "Unexpected Dropbox Error: " + e.toString();
            }
        }
        String searchDir = TESTS_DIR + "/searchDir/";
        uploadFile(foo, searchDir + "text.txt");
        uploadFile(foo, searchDir + "subFolder/text.txt");
        uploadFile(foo, searchDir + "subFolder/cow.txt");
        uploadFile(frog, searchDir + "frog.jpg");
        uploadFile(frog, searchDir + "frog2.jpg");
        uploadFile(frog, searchDir + "subFolder/frog2.jpg");

        List<Entry> results = api.search(searchDir, "sadfasdf", 1000, false);
        assertEquals(results.size(), 0);

        results = api.search(searchDir, "jpg", 1000, false);

        assertEquals(results.size(), 3);

        HashSet<String> resultPaths = new HashSet<String>();
        for (DropboxAPI.Entry e : results) {
            assertEquals(e.bytes, frog.length());
            assertEquals(e.isDir, false);
            resultPaths.add(e.path);
        }
        resultPaths.equals(new HashSet<String>(Arrays.asList(
                searchDir + "frog.jpg",
                searchDir + "frog2.jpg",
                searchDir + "subFolder/frog2.jpg")));

        results = api.search(searchDir + "subFolder", "jpg", 1000, false);

        assertEquals(results.size(), 1);

        assertFile(results.get(0), frog, searchDir + "subFolder/frog2.jpg");
    }