@Test
  public void addAndGetMacroInvocations() {
    MacroInvocation invocation =
        htmlSerializerContext.addMacroInvocation("foo", "params"); // $NON-NLS-1$ //$NON-NLS-2$
    assertEquals("foo", invocation.getMacroName()); // $NON-NLS-1$
    assertEquals("params", invocation.getParameters()); // $NON-NLS-1$

    List<MacroInvocation> invocations = htmlSerializerContext.getMacroInvocations();
    assertEquals(1, invocations.size());
    invocation = invocations.get(0);
    assertEquals("foo", invocation.getMacroName()); // $NON-NLS-1$
    assertEquals("params", invocation.getParameters()); // $NON-NLS-1$
  }
  @Test
  public void addAndGetHeaders() {
    Header[] headers = {
      new Header("foo", 1), // $NON-NLS-1$
      new Header("bar", 2), // $NON-NLS-1$
      new Header("baz", 3) // $NON-NLS-1$
    };
    for (Header header : headers) {
      htmlSerializerContext.addHeader(header.getText(), header.getLevel());
    }

    List<Header> result = htmlSerializerContext.getHeaders();
    for (int i = 0; i < result.size(); i++) {
      assertTrue(EqualsBuilder.reflectionEquals(result.get(i), headers[i], true));
    }
  }
 @Test
 public void markdownToHtml() {
   when(markdownProcessor.markdownToHtml(
           "md", PROJECT, BRANCH, PAGE, authentication, Locale.US, CONTEXT))
       .thenReturn("html"); // $NON-NLS-1$ //$NON-NLS-2$
   assertEquals("html", htmlSerializerContext.markdownToHtml("md")); // $NON-NLS-1$ //$NON-NLS-2$
 }
 @Test
 public void getAttachmentUri() {
   String uri = htmlSerializerContext.getAttachmentUri("test.png"); // $NON-NLS-1$
   assertEquals(
       CONTEXT
           + "/attachment/"
           + PROJECT
           + "/"
           + BRANCH
           + "/"
           + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
           Util.toUrlPagePath(PAGE)
           + "/test.png", //$NON-NLS-1$
       uri);
 }
 @Test
 public void getPageUri() {
   String page = "foo/bar/baz"; // $NON-NLS-1$
   String uri = htmlSerializerContext.getPageUri(page);
   assertEquals(
       CONTEXT
           + "/page/"
           + PROJECT
           + "/"
           + BRANCH
           + "/"
           + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
           Util.toUrlPagePath(page),
       uri);
 }
 @Test
 public void getUrl() {
   String result = htmlSerializerContext.getUrl(CONTEXT + "/foo/bar"); // $NON-NLS-1$
   assertEquals(DOCUMENTR_HOST + "/foo/bar", result); // $NON-NLS-1$
 }