private void doTest(String xmlBody, String expectedResult, String domain,
String username, String password, Collection<?> groups) {
LOGGER.info("============== " + getName() + " ====================");
LOGGER.info("xmlBody:\n" + xmlBody);
MockManager manager = MockManager.getInstance();
manager.setShouldVerifyIdentity(true);
manager.setExpectedIdentity(domain, username, password, groups);
StringWriter writer = new StringWriter();
PrintWriter out = new PrintWriter(writer);
Authenticate.handleDoPost(xmlBody, manager, out);
out.flush();
String result = writer.toString();