Commit 422eb50e authored by Ubbo Veentjer's avatar Ubbo Veentjer
Browse files

let jsp do the npe checking. closes #57

parent 1b889d4b
Pipeline #138427 passed with stages
in 9 minutes and 43 seconds
......@@ -89,7 +89,7 @@ public class SearchController {
model.addAttribute("mode", mode);
model.addAttribute("results", res.getResult());
model.addAttribute("facets", res.getFacetResponse().getFacetGroup());
model.addAttribute("facetResponse", res.getFacetResponse());
model.addAttribute("query", HtmlUtils.htmlEscape(query));
model.addAttribute("order", order);
model.addAttribute("start", start);
......
......@@ -64,7 +64,7 @@
</section>
</c:if>
<c:forEach items="${facets}" var="facetGroup">
<c:forEach items="${facetResponse.facetGroup}" var="facetGroup">
<c:if test="${facetGroup.facet.size() != 0}">
<section class="tgrep sidebar_panel">
<h3 class="tgrep sidebar_subheading">${i18n[facetGroup.name]}</h3>
......
......@@ -130,6 +130,17 @@ public class SearchControllerTest {
.andExpect(model().attribute("filter", hasSize(2)));
}
// #57 - NPE when no facetresponse set (empty result)
@Test
public void noResults() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/search")
.queryParam("query", "(genre:\"roman\") AND (work.dateOfCreation.date:\"18??\") AND format:\"text/xml\"")
.accept(MediaType.TEXT_HTML))
.andExpect(status().isOk())
.andExpect(view().name("search"))
.andExpect(forwardedUrl("/WEB-INF/jsp/search.jsp"));
}
// TODO: test gallery image view: changing filters, view or limit should persist the
// already set properties and not drop them
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment