### Question:
EnsureOakIndexServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { String forceParam = StringUtils.defaultIfEmpty(request.getParameter(PARAM_FORCE), "false"); boolean force = Boolean.parseBoolean(forceParam); String path = StringUtils.stripToNull(request.getParameter(PARAM_PATH)); try { int count; String message; if (StringUtils.isBlank(path)) { count = ensureOakIndexManager.ensureAll(force); message = String.format("Initiated the FORCE ensuring of [ %d ] all oak index ensure definitions", count); } else { count = ensureOakIndexManager.ensure(force, path); message = String.format("Initiated the [ %s ] ensuring of [ %d ] oak index ensure definitions at path [ %s ]", force ? "FORCE" : "UN-FORCED", count, path); } response.setContentType("text/plain; charset=utf-8"); response.getWriter().println(message); response.setStatus(HttpServletResponse.SC_OK); } catch (IOException e) { log.warn("Caught IOException while handling doPost() in the Ensure Oak Index Servlet", e); response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }    }### Answer:
@Test public void testPostWithForce() throws IOException { context.request().setParameterMap(ImmutableMap.of("force","true")); servlet.doPost(context.request(), context.response()); verify(ensureOakIndexManager).ensureAll(true); assertEquals(HttpServletResponse.SC_OK,context.response().getStatus()); }
@Test public void testPostWithPathAndNonForce() throws IOException { context.request().setParameterMap(ImmutableMap.of("force","blub","path",INDEX_PATH)); servlet.doPost(context.request(), context.response()); verify(ensureOakIndexManager).ensure(false, INDEX_PATH); assertEquals(HttpServletResponse.SC_OK,context.response().getStatus()); }