GetMethod getMethod =
executeGet(String.format("%s?q=somethingthatcannotpossiblyexist", getUriBuilder(SpaceSearchResource.class)
.build(getWiki(), "Main")));
Assert.assertEquals(getHttpMethodInfo(getMethod), HttpStatus.SC_OK, getMethod.getStatusCode());
SearchResults searchResults = (SearchResults) unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());
Assert.assertEquals(0, searchResults.getSearchResults().size());
getMethod =
executeGet(String.format("%s?q=sandbox", getUriBuilder(WikiSearchResource.class)
.build(getWiki(), "Sandbox")));
Assert.assertEquals(getHttpMethodInfo(getMethod), HttpStatus.SC_OK, getMethod.getStatusCode());
searchResults = (SearchResults) unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());
int resultSize = searchResults.getSearchResults().size();
Assert.assertTrue("Found " + resultSize + " result", resultSize >= 2);
for (SearchResult searchResult : searchResults.getSearchResults()) {
checkLinks(searchResult);
}
}