AudienceRestrictionType audienceRestrictionType = (AudienceRestrictionType) conditions.getConditions().get(0);
assertEquals(1, audienceRestrictionType.getAudience().size());
assertEquals("http://services.testcorp.org/provider2", audienceRestrictionType.getAudience().get(0).toASCIIString());
ByteArrayOutputStream baos = new ByteArrayOutputStream();
// Lets do the writing
SAMLAssertionWriter writer = new SAMLAssertionWriter(StaxUtil.getXMLStreamWriter(baos));
writer.write(assertion);
String writtenString = new String(baos.toByteArray());
Logger.getLogger(SAMLAssertionParserTestCase.class).debug(writtenString);
validateSchema(writtenString);
}