AppsBlock extends HtmlBlock { @Override public void render(Block html) { setTitle("Applications"); try { fetchData(); } catch (YarnException | IOException | InterruptedException e) { String message = "Failed to read the applications."; LOG.error(message, e); html.p().__(message).__(); return; } renderData(html); } @Inject protected  AppsBlock(ApplicationBaseProtocol appBaseProt, ViewContext ctx); @Override void render(Block html);  }
@Test(expected = IllegalArgumentException.class) public void testInvalidAppState() { AppsBlock appBlock = new AppsBlock(null, null) { @Override public Map<String, String> moreParams() { Map<String, String> map = new HashMap<>(); map.put(YarnWebParams.APP_STATE, "ACCEPTEDPING"); return map; } @Override protected void renderData(Block html) { } }; OutputStream outputStream = new ByteArrayOutputStream(); HtmlBlock.Block block = createBlockToCreateTo(outputStream); appBlock.render(block); }