PipelineManagerServlet extends AbstractApiServlet { @Override protected void get(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String[] names = req.getParameterValues(PARAM_NAME); Collection<BaleenPipeline> list; if (names == null || names.length == 0) { list = manager.getAll(); } else { list = new LinkedList<>(); for (String n : names) { if (n == null) { continue; } Optional<BaleenPipeline> p = manager.get(n); if (p.isPresent()) { list.add(p.get()); } } } respondWithJson(resp, list); } PipelineManagerServlet(BaleenPipelineManager manager);  PipelineManagerServlet(Logger logger, Class<?> clazz, BaleenPipelineManager manager); @Override WebPermission[] getPermissions(); static final String PARAM_NAME; static final String PARAM_YAML; static final String PARAM_MULTIPLICITY; }
@Test public void testGetWithName() throws Exception { ServletCaller caller = new ServletCaller(); caller.setRequestUri(ROOT); caller.addParameter(NAME, REAL); caller.doGet(new PipelineManagerServlet(pipelineManager)); assertEquals(200, caller.getResponseStatus().intValue()); verify(pipelineManager).get(REAL); assertTrue(caller.getResponseBody().contains(REAL)); }