request.startInnerElement("query", NamespaceURIs.XEP0030_SERVICE_DISCOVERY_INFO).endInnerElement();
return request;
}
private void assertIdentity(XMLElement queryElement) throws XMLSemanticError {
Identity expectedIdentity = getExpectedIdentity();
if (expectedIdentity != null) {
XMLElement identityElement = queryElement.getSingleInnerElementsNamed("identity");
assertNotNull("Identity element must exist", identityElement);
assertEquals("Identity category", expectedIdentity.getCategory(), identityElement
.getAttributeValue("category"));
assertEquals("Identity type", expectedIdentity.getType(), identityElement.getAttributeValue("type"));
if (expectedIdentity.getName() != null) {
assertEquals("Identity name", expectedIdentity.getName(), identityElement.getAttributeValue("name"));
} else {
assertNull("Identity name attribute should be missing", identityElement.getAttributeValue("name"));
}
}
}