@@ -2804,7 +2804,7 @@ public void testIsValidSignWithEmptyReferenceURI() throws IOException, Error, XP
28042804 }
28052805
28062806 /**
2807- * Tests the getError method of SamlResponse
2807+ * Tests the getError and getValidationException methods of SamlResponse
28082808 *
28092809 * @throws ValidationError
28102810 * @throws SettingsException
@@ -2823,25 +2823,32 @@ public void testGetError() throws IOException, Error, XPathExpressionException,
28232823 String samlResponseEncoded = Util .getFileAsString ("data/responses/response4.xml.base64" );
28242824 SamlResponse samlResponse = new SamlResponse (settings , newHttpRequest (samlResponseEncoded ));
28252825 assertNull (samlResponse .getError ());
2826+ assertNull (samlResponse .getValidationException ());
28262827 samlResponse .isValid ();
28272828 assertThat (samlResponse .getError (), containsString ("SAML Response must contain 1 Assertion." ));
2829+ assertTrue (samlResponse .getValidationException () instanceof ValidationError );
28282830
28292831 settings .setStrict (false );
28302832 samlResponse = new SamlResponse (settings , newHttpRequest (samlResponseEncoded ));
28312833 samlResponse .isValid ();
28322834 assertThat (samlResponse .getError (), containsString ("SAML Response must contain 1 Assertion." ));
2835+ assertTrue (samlResponse .getValidationException () instanceof ValidationError );
28332836
28342837 samlResponseEncoded = Util .getFileAsString ("data/responses/valid_response.xml.base64" );
28352838 samlResponse = new SamlResponse (settings , newHttpRequest (samlResponseEncoded ));
28362839 assertNull (samlResponse .getError ());
2840+ assertNull (samlResponse .getValidationException ());
28372841 samlResponse .isValid ();
28382842 assertNull (samlResponse .getError ());
2843+ assertNull (samlResponse .getValidationException ());
28392844
28402845 settings .setStrict (true );
28412846 samlResponse = new SamlResponse (settings , newHttpRequest (samlResponseEncoded ));
28422847 assertNull (samlResponse .getError ());
2848+ assertNull (samlResponse .getValidationException ());
28432849 samlResponse .isValid ();
28442850 assertNull (samlResponse .getError ());
2851+ assertNull (samlResponse .getValidationException ());
28452852 }
28462853
28472854 private String loadAndEncode (String path ) throws Exception
0 commit comments