// Href string
final String testHref = "/path/to/stuff_here";
// Create the test buffer
TestDOMOutputBuffer buffer = new TestDOMOutputBuffer();
// Create the renderer
DefaultNumericShortcutEmulationRenderer renderer =
new DefaultNumericShortcutEmulationRenderer(customisation);
// Start the call
renderer.start(buffer);
// Add some content...
Element element = buffer.openElement("a");
element.setAttribute("href", testHref);
element.setAttribute("accesskey", renderer.getShortcut().getText(TextEncoding.PLAIN));
buffer.appendEncoded(testContent);
buffer.closeElement(element);
// End the call
renderer.end(buffer);
// Create expected
String required = "<" + AccesskeyConstants.ACCESSKEY_ANNOTATION_ELEMENT +
"><a href=\"" + testHref + "\" accesskey=\"" +
renderer.getShortcut().getText(TextEncoding.PLAIN) + "\">" + testContent +
"</a></" + AccesskeyConstants.ACCESSKEY_ANNOTATION_ELEMENT + ">";
String expected = DOMUtilities.provideDOMNormalizedString(required);
// Check state of buffer
assertFalse("Should be contents in the buffer", buffer.isEmpty());
// Extract the output from the menu rendering as a string.
String actual = DOMUtilities.toString(buffer.getRoot());
assertNotNull("The actual string should exist", actual);
// Compare state and expected
assertEquals("Strings should match", expected, actual);
}