* @throws ProtocolException
*/
public void testAnchorNameIdentification() throws ProtocolException, RepositoryException {
// Set up the protocol and dependent objects.
privateSetUp();
DOMOutputBuffer buffer = new DOMOutputBuffer();
buffer.initialise();
// Initialise our protocol attributes with an id attribute.
String idValue = "the identifier value";
AnchorAttributes attributes = new AnchorAttributes();
attributes.setStyles(StylesBuilder.getInitialValueStyles());
attributes.setId(idValue);
// Create the expected value for the name attribute output.
String expectedNameValue = null;
if (protocol.enableNameIdentification) {
expectedNameValue = idValue;
}
// Open and close the anchor to generate the markup.
protocol.openAnchor(buffer, attributes);
protocol.closeAnchor(buffer, attributes);
// Check that the element generated has appropriate id and name
// attributes.
Element root = buffer.getCurrentElement();
Element element = (Element) root.getHead();
// // Handle the case where some protocols wrap the tag in another tag.
// if (!element.getName().equals("a")) {
// element = (Element) element.getHead();
// }