@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);
  }
@Test(expected = IllegalArgumentException.class)
  public void testInvalidAppState() {
    AppsBlock appBlock = new AppsBlock(null, null) {
      // override this so that apps block can fetch app state.
      @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) {
      }
    };

    // set up the test block to render AppsBlock
    OutputStream outputStream = new ByteArrayOutputStream();
    HtmlBlock.Block block = createBlockToCreateTo(outputStream);

    // If application state is invalid it should throw exception
    // instead of catching it.
    appBlock.render(block);
  }