[java-opensaml] branch main updated: IDP-2069 - Null Handling Task

Scott Cantor cantor.2 at osu.edu
Mon Apr 17 14:22:11 UTC 2023


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository java-opensaml.

View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=8f5d8ecfbbfdb6929215997ce10b479209345b49

The following commit(s) were added to refs/heads/main by this push:
     new 8f5d8ecfb IDP-2069 - Null Handling Task
8f5d8ecfb is described below

commit 8f5d8ecfbbfdb6929215997ce10b479209345b49
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Apr 17 10:22:08 2023 -0400

    IDP-2069 - Null Handling Task
    
    https://shibboleth.atlassian.net/browse/IDP-2069
    
    Test cleanup.
---
 .../saml/ext/saml2mdui/impl/DisplayNameTest.java   |   5 +-
 .../saml/ext/saml2mdui/impl/DomainHintTest.java    |   5 +-
 .../ext/saml2mdui/impl/GeolocationHintTest.java    |   6 +-
 .../saml/ext/saml2mdui/impl/IPHintTest.java        |   5 +-
 .../ext/saml2mdui/impl/InformationURLTest.java     |   6 +-
 .../saml/ext/saml2mdui/impl/KeywordsTest.java      |   7 +-
 .../opensaml/saml/ext/saml2mdui/impl/LogoTest.java |  10 +-
 .../saml2mdui/impl/PrivacyStatementURLTest.java    |   5 +-
 .../saml/ext/saml2mdui/impl/UIInfoTest.java        |   9 +-
 .../encryption/tests/ComplexEncryptionTest.java    |  93 ++++++++-----
 .../encryption/tests/SimpleEncryptionTest.java     | 151 +++++++++++++--------
 11 files changed, 184 insertions(+), 118 deletions(-)

diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/DisplayNameTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/DisplayNameTest.java
index e38805337..ca50ea842 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/DisplayNameTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/DisplayNameTest.java
@@ -46,7 +46,8 @@ public class DisplayNameTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testSingleElementUnmarshall() {
-        DisplayName name = (DisplayName) unmarshallElement(singleElementFile);
+        final DisplayName name = (DisplayName) unmarshallElement(singleElementFile);
+        assert name != null;
         
         Assert.assertEquals(name.getValue(), expectValue, "Name was not expected value");
         Assert.assertEquals(name.getXMLLang(), expectLang, "xml:lang was not expected value");
@@ -55,7 +56,7 @@ public class DisplayNameTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testSingleElementMarshall() {
-        DisplayName name = (DisplayName) buildXMLObject(DisplayName.DEFAULT_ELEMENT_NAME);
+        final DisplayName name = (DisplayName) buildXMLObject(DisplayName.DEFAULT_ELEMENT_NAME);
         
         name.setValue(expectValue);
         name.setXMLLang(expectLang);
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/DomainHintTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/DomainHintTest.java
index c971753d0..47652c60c 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/DomainHintTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/DomainHintTest.java
@@ -50,7 +50,8 @@ public class DomainHintTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testSingleElementUnmarshall() {
-        DomainHint hint = (DomainHint) unmarshallElement(singleElementFile);
+        final DomainHint hint = (DomainHint) unmarshallElement(singleElementFile);
+        assert hint != null;
         
         Assert.assertEquals(hint.getValue(), expectedHint, "Name was not expected value");
     }
@@ -58,7 +59,7 @@ public class DomainHintTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testSingleElementMarshall() {
-        DomainHint hint = (DomainHint) buildXMLObject(DomainHint.DEFAULT_ELEMENT_NAME);
+        final DomainHint hint = (DomainHint) buildXMLObject(DomainHint.DEFAULT_ELEMENT_NAME);
         
         hint.setValue(expectedHint);
 
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/GeolocationHintTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/GeolocationHintTest.java
index 7e9ab87b1..8a46803fb 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/GeolocationHintTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/GeolocationHintTest.java
@@ -50,15 +50,15 @@ public class GeolocationHintTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testSingleElementUnmarshall() {
-        GeolocationHint hint = (GeolocationHint) unmarshallElement(singleElementFile);
-        
+        final GeolocationHint hint = (GeolocationHint) unmarshallElement(singleElementFile);
+        assert hint != null;
         Assert.assertEquals(hint.getURI(), expectedHint, "Name was not expected value");
     }
 
     /** {@inheritDoc} */
     @Test
     public void testSingleElementMarshall() {
-        GeolocationHint hint = (GeolocationHint) buildXMLObject(GeolocationHint.DEFAULT_ELEMENT_NAME);
+        final GeolocationHint hint = (GeolocationHint) buildXMLObject(GeolocationHint.DEFAULT_ELEMENT_NAME);
         
         hint.setURI(expectedHint);
 
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/IPHintTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/IPHintTest.java
index 3615deff1..8a58a607b 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/IPHintTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/IPHintTest.java
@@ -50,7 +50,8 @@ public class IPHintTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testSingleElementUnmarshall() {
-        IPHint hint = (IPHint) unmarshallElement(singleElementFile);
+        final IPHint hint = (IPHint) unmarshallElement(singleElementFile);
+        assert hint != null;
         
         Assert.assertEquals(hint.getValue(), expectedHint, "Name was not expected value");
     }
@@ -58,7 +59,7 @@ public class IPHintTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testSingleElementMarshall() {
-        IPHint hint = (IPHint) buildXMLObject(IPHint.DEFAULT_ELEMENT_NAME);
+        final IPHint hint = (IPHint) buildXMLObject(IPHint.DEFAULT_ELEMENT_NAME);
         
         hint.setValue(expectedHint);
 
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/InformationURLTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/InformationURLTest.java
index 80843a3b9..83438e5a9 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/InformationURLTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/InformationURLTest.java
@@ -46,8 +46,8 @@ public class InformationURLTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testSingleElementUnmarshall() {
-        InformationURL url = (InformationURL) unmarshallElement(singleElementFile);
-
+        final InformationURL url = (InformationURL) unmarshallElement(singleElementFile);
+        assert url != null;
         Assert.assertEquals(url.getURI(), expectValue, "URI was not expected value");
         Assert.assertEquals(url.getXMLLang(), expectLang, "xml:lang was not expected value");
 
@@ -56,7 +56,7 @@ public class InformationURLTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testSingleElementMarshall() {
-        InformationURL url = (InformationURL) buildXMLObject(InformationURL.DEFAULT_ELEMENT_NAME);
+        final InformationURL url = (InformationURL) buildXMLObject(InformationURL.DEFAULT_ELEMENT_NAME);
         
         url.setURI(expectValue);
         url.setXMLLang(expectLang);
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/KeywordsTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/KeywordsTest.java
index a425d8e0d..215fba61d 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/KeywordsTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/KeywordsTest.java
@@ -57,12 +57,13 @@ public class KeywordsTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testSingleElementUnmarshall() {
-        Keywords name = (Keywords) unmarshallElement(singleElementFile);
+        final Keywords name = (Keywords) unmarshallElement(singleElementFile);
+        assert name != null;
         
         assertEquals(name.getKeywords(), expectedWords, "Keyworks were not expected value");
         assertEquals(name.getXMLLang(), expectedLang, "Language was not expected value");
 
-        Keywords keywords = (Keywords) buildXMLObject(Keywords.DEFAULT_ELEMENT_NAME);
+        final Keywords keywords = (Keywords) buildXMLObject(Keywords.DEFAULT_ELEMENT_NAME);
         assertNotEquals(keywords, name);
         keywords.setXMLLang(expectedLang);
         assertNotEquals(keywords, name);
@@ -73,7 +74,7 @@ public class KeywordsTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testSingleElementMarshall() {
-        Keywords keywords = (Keywords) buildXMLObject(Keywords.DEFAULT_ELEMENT_NAME);
+        final Keywords keywords = (Keywords) buildXMLObject(Keywords.DEFAULT_ELEMENT_NAME);
         keywords.setXMLLang(expectedLang);
         keywords.setKeywords(expectedWords);
 
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/LogoTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/LogoTest.java
index 0f7158a1f..4b5770893 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/LogoTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/LogoTest.java
@@ -58,7 +58,8 @@ public class LogoTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testSingleElementUnmarshall() {
-        Logo logo = (Logo) unmarshallElement(singleElementFile);
+        final Logo logo = (Logo) unmarshallElement(singleElementFile);
+        assert logo != null;
         
         Assert.assertEquals(logo.getURI(), expectedURL, "URL was not expected value");
         Assert.assertEquals(logo.getHeight(), expectedHeight, "height was not expected value");
@@ -68,7 +69,8 @@ public class LogoTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testSingleElementOptionalAttributesUnmarshall() {
-        Logo logo = (Logo) unmarshallElement(singleElementOptionalAttributesFile);
+        final Logo logo = (Logo) unmarshallElement(singleElementOptionalAttributesFile);
+        assert logo != null;
         
         Assert.assertEquals(logo.getURI(), expectedURL, "URL was not expected value");
         Assert.assertEquals(logo.getHeight(), expectedHeight, "height was not expected value");
@@ -79,7 +81,7 @@ public class LogoTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testSingleElementMarshall() {
-        Logo logo = (Logo) buildXMLObject(Logo.DEFAULT_ELEMENT_NAME);
+        final Logo logo = (Logo) buildXMLObject(Logo.DEFAULT_ELEMENT_NAME);
         
         logo.setURI(expectedURL);
         logo.setWidth(expectedWidth);
@@ -91,7 +93,7 @@ public class LogoTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testSingleElementOptionalAttributesMarshall() {
-        Logo logo = (Logo) buildXMLObject(Logo.DEFAULT_ELEMENT_NAME);
+        final Logo logo = (Logo) buildXMLObject(Logo.DEFAULT_ELEMENT_NAME);
         
         logo.setURI(expectedURL);
         logo.setWidth(expectedWidth);
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/PrivacyStatementURLTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/PrivacyStatementURLTest.java
index 36a139a5e..e55a40a03 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/PrivacyStatementURLTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/PrivacyStatementURLTest.java
@@ -47,7 +47,8 @@ public class PrivacyStatementURLTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testSingleElementUnmarshall() {
-        PrivacyStatementURL url = (PrivacyStatementURL) unmarshallElement(singleElementFile);
+        final PrivacyStatementURL url = (PrivacyStatementURL) unmarshallElement(singleElementFile);
+        assert url != null;
         
         Assert.assertEquals(url.getURI(), expectValue, "URI was not expected value");
         Assert.assertEquals(url.getXMLLang(), expectLang, "xml:lang was not expected value");
@@ -56,7 +57,7 @@ public class PrivacyStatementURLTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testSingleElementMarshall() {
-        PrivacyStatementURL url = (PrivacyStatementURL) buildXMLObject(PrivacyStatementURL.DEFAULT_ELEMENT_NAME);
+        final PrivacyStatementURL url = (PrivacyStatementURL) buildXMLObject(PrivacyStatementURL.DEFAULT_ELEMENT_NAME);
         
         url.setURI(expectValue);
         url.setXMLLang(expectLang);
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/UIInfoTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/UIInfoTest.java
index ce9078d79..1c5c1d54d 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/UIInfoTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/ext/saml2mdui/impl/UIInfoTest.java
@@ -70,7 +70,7 @@ public class UIInfoTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testSingleElementUnmarshall() {
-        UIInfo uiinfo = (UIInfo) unmarshallElement(singleElementFile);
+        final UIInfo uiinfo = (UIInfo) unmarshallElement(singleElementFile);
         
         Assert.assertNotNull(uiinfo, "UIInfo");
     }
@@ -78,7 +78,7 @@ public class UIInfoTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testSingleElementMarshall() {
-        UIInfo uiinfo = (UIInfo) buildXMLObject(UIInfo.DEFAULT_ELEMENT_NAME);
+        final UIInfo uiinfo = (UIInfo) buildXMLObject(UIInfo.DEFAULT_ELEMENT_NAME);
         
         assertXMLEquals(expectedDOM, uiinfo);
     }
@@ -86,7 +86,8 @@ public class UIInfoTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testChildElementsUnmarshall(){
-        UIInfo uiinfo = (UIInfo) unmarshallElement(childElementsFile);
+        final UIInfo uiinfo = (UIInfo) unmarshallElement(childElementsFile);
+        assert uiinfo != null;
         
         Assert.assertEquals(uiinfo.getDisplayNames().size(), expectedDisplayNamesCount, "<DisplayName> count");
         Assert.assertEquals(uiinfo.getDescriptions().size(), expectedDescriptionsCount, "<Descriptions> count");
@@ -103,7 +104,7 @@ public class UIInfoTest extends XMLObjectProviderBaseTestCase {
     /** {@inheritDoc} */
     @Test
     public void testChildElementsMarshall(){
-        UIInfo uiinfo = (UIInfo) buildXMLObject(UIInfo.DEFAULT_ELEMENT_NAME);
+        final UIInfo uiinfo = (UIInfo) buildXMLObject(UIInfo.DEFAULT_ELEMENT_NAME);
         
         uiinfo.getDisplayNames().add((DisplayName) buildXMLObject(DisplayName.DEFAULT_ELEMENT_NAME));
 
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/encryption/tests/ComplexEncryptionTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/encryption/tests/ComplexEncryptionTest.java
index 249e0053d..458372579 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/encryption/tests/ComplexEncryptionTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/encryption/tests/ComplexEncryptionTest.java
@@ -33,10 +33,12 @@ import org.opensaml.saml.saml2.encryption.Encrypter;
 import org.opensaml.saml.saml2.encryption.Encrypter.KeyPlacement;
 import org.opensaml.security.credential.Credential;
 import org.opensaml.xmlsec.algorithm.AlgorithmSupport;
+import org.opensaml.xmlsec.encryption.CarriedKeyName;
 import org.opensaml.xmlsec.encryption.DataReference;
 import org.opensaml.xmlsec.encryption.EncryptedData;
 import org.opensaml.xmlsec.encryption.EncryptedKey;
 import org.opensaml.xmlsec.encryption.EncryptionMethod;
+import org.opensaml.xmlsec.encryption.ReferenceList;
 import org.opensaml.xmlsec.encryption.support.EncryptionConstants;
 import org.opensaml.xmlsec.encryption.support.EncryptionException;
 import org.opensaml.xmlsec.encryption.support.DataEncryptionParameters;
@@ -193,39 +195,47 @@ public class ComplexEncryptionTest extends XMLObjectBaseTestCase {
         Assert.assertTrue(encObject instanceof EncryptedAssertion, 
                 "Encrypted object was not an instance of the expected type");
         encTarget = (EncryptedAssertion) encObject;
+        assert encTarget != null;
+        
+        final EncryptedData encData = encTarget.getEncryptedData();
+        assert encData != null;
         
-        Assert.assertEquals(encTarget.getEncryptedData().getKeyInfo().getEncryptedKeys().size(), 0, 
+        KeyInfo keyInfo = encData.getKeyInfo();
+        assert keyInfo != null;
+        Assert.assertEquals(keyInfo.getEncryptedKeys().size(), 0, 
                 "Number of inline EncryptedKeys");
         Assert.assertEquals(encTarget.getEncryptedKeys().size(), 1, 
                 "Number of peer EncryptedKeys");
         
         
-        EncryptedKey encKey = encTarget.getEncryptedKeys().get(0);
-        Assert.assertNotNull(encKey, "EncryptedKey was null");
+        final EncryptedKey encKey = encTarget.getEncryptedKeys().get(0);
+        assert encKey != null;
         
-        Assert.assertEquals(encKey.getEncryptionMethod().getAlgorithm(), kekURIRSA, 
-                "Algorithm attribute");
-        Assert.assertNotNull(encKey.getKeyInfo(), "KeyInfo");
-        Assert.assertEquals(encKey.getKeyInfo().getKeyNames().get(0).getValue(), expectedKeyNameRSA, 
-                "KeyName");
+        final EncryptionMethod method = encKey.getEncryptionMethod();
+        assert method != null;
+        Assert.assertEquals(method.getAlgorithm(), kekURIRSA, "Algorithm attribute");
+        keyInfo = encKey.getKeyInfo();
+        assert keyInfo != null;
+        Assert.assertEquals(keyInfo.getKeyNames().get(0).getValue(), expectedKeyNameRSA, "KeyName");
         
         Assert.assertFalse(Strings.isNullOrEmpty(encKey.getID()),
                 "EncryptedKey ID attribute was empty");
         
-        EncryptedData encData = encTarget.getEncryptedData();
-        Assert.assertNotNull(encData.getKeyInfo(), "EncryptedData KeyInfo wasn't null");
-        Assert.assertEquals(encData.getKeyInfo().getRetrievalMethods().size(), 1,
+        keyInfo = encData.getKeyInfo();
+        assert keyInfo != null;
+        Assert.assertEquals(keyInfo.getRetrievalMethods().size(), 1,
                 "EncryptedData contained invalid number RetrievalMethods");
-        RetrievalMethod rm = encData.getKeyInfo().getRetrievalMethods().get(0);
+        RetrievalMethod rm = keyInfo.getRetrievalMethods().get(0);
         Assert.assertEquals(rm.getType(),
                 EncryptionConstants.TYPE_ENCRYPTED_KEY, "EncryptedData RetrievalMethod had incorrect type attribute");
         Assert.assertEquals(rm.getURI(),
                 "#" + encKey.getID(), "EncryptedData RetrievalMethod had incorrect URI value");
         
-        Assert.assertNotNull(encKey.getReferenceList(), "EncryptedKey ReferenceList was null");
-        Assert.assertEquals(encKey.getReferenceList().getDataReferences().size(), 1,
+        final ReferenceList reflist = encKey.getReferenceList();
+        assert reflist != null;
+        Assert.assertEquals(reflist.getDataReferences().size(), 1,
                 "EncryptedKey contained invalid number DataReferences");
-        DataReference dr = encKey.getReferenceList().getDataReferences().get(0);
+        DataReference dr = reflist.getDataReferences().get(0);
         Assert.assertEquals(dr.getURI(),
                 "#" + encData.getID(), "EncryptedKey DataReference had incorrect URI value");
         Assert.assertNull(encKey.getCarriedKeyName(), "EncryptedKey CarriedKeyName wasn't null");
@@ -263,8 +273,13 @@ public class ComplexEncryptionTest extends XMLObjectBaseTestCase {
         Assert.assertTrue(encObject instanceof EncryptedAssertion, 
                 "Encrypted object was not an instance of the expected type");
         encTarget = (EncryptedAssertion) encObject;
+        assert encTarget != null;
         
-        Assert.assertEquals(encTarget.getEncryptedData().getKeyInfo().getEncryptedKeys().size(), 0, 
+        final EncryptedData encData = encTarget.getEncryptedData();
+        assert encData != null;
+        final KeyInfo keyInfo = encData.getKeyInfo();
+        assert keyInfo != null;
+        Assert.assertEquals(keyInfo.getEncryptedKeys().size(), 0, 
                 "Number of inline EncryptedKeys");
         Assert.assertEquals(encTarget.getEncryptedKeys().size(), 2, 
                 "Number of peer EncryptedKeys");
@@ -275,49 +290,53 @@ public class ComplexEncryptionTest extends XMLObjectBaseTestCase {
         Assert.assertNotNull(encKeyRSA, "EncryptedKey was null");
         Assert.assertNotNull(encKeyAES, "EncryptedKey was null");
         
-        Assert.assertEquals(encKeyRSA.getEncryptionMethod().getAlgorithm(), kekURIRSA, 
-                "Algorithm attribute");
-        Assert.assertEquals(encKeyAES.getEncryptionMethod().getAlgorithm(), kekURIAES, 
-                "Algorithm attribute");
+        EncryptionMethod method = encKeyRSA.getEncryptionMethod();
+        assert method != null;
+        Assert.assertEquals(method.getAlgorithm(), kekURIRSA, "Algorithm attribute");
+        method = encKeyAES.getEncryptionMethod();
+        assert method != null;
+        Assert.assertEquals(method.getAlgorithm(), kekURIAES, "Algorithm attribute");
         
         Assert.assertFalse(Strings.isNullOrEmpty(encKeyRSA.getID()),
                 "EncryptedKey ID attribute was empty");
         Assert.assertFalse(Strings.isNullOrEmpty(encKeyAES.getID()),
                 "EncryptedKey ID attribute was empty");
         
-        EncryptedData encData = encTarget.getEncryptedData();
-        Assert.assertNotNull(encData.getKeyInfo(), "EncryptedData KeyInfo wasn't null");
-        Assert.assertEquals(encData.getKeyInfo().getRetrievalMethods().size(), 0,
+        Assert.assertEquals(keyInfo.getRetrievalMethods().size(), 0,
                 "EncryptedData contained invalid number RetrievalMethods");
-        Assert.assertEquals(encData.getKeyInfo().getKeyNames().size(), 1,
+        Assert.assertEquals(keyInfo.getKeyNames().size(), 1,
                 "EncryptedData contained invalid number KeyNames");
-        KeyName encDataKeyName = encData.getKeyInfo().getKeyNames().get(0);
+        KeyName encDataKeyName = keyInfo.getKeyNames().get(0);
         Assert.assertEquals(encDataKeyName.getValue(), multicastKeyNameValue, "EncryptedData KeyName value");
         
         DataReference dr = null;
         
         Assert.assertEquals(encKeyRSA.getRecipient(), expectedRecipientRSA,
                 "EncryptedKey recipient attribute had invalid value");
-        Assert.assertNotNull(encKeyRSA.getReferenceList(), "EncryptedKey ReferenceList was null");
-        Assert.assertEquals(encKeyRSA.getReferenceList().getDataReferences().size(), 1,
+        ReferenceList reflist = encKeyRSA.getReferenceList();
+        assert reflist != null;
+        Assert.assertEquals(reflist.getDataReferences().size(), 1,
                 "EncryptedKey contained invalid number DataReferences");
-        dr = encKeyRSA.getReferenceList().getDataReferences().get(0);
+        dr = reflist.getDataReferences().get(0);
         Assert.assertEquals(dr.getURI(),
                 "#" + encData.getID(), "EncryptedKey DataReference had incorrect URI value");
-        Assert.assertNotNull(encKeyRSA.getCarriedKeyName(), "EncryptedKey CarriedKeyName wasn't null");
-        Assert.assertEquals(encKeyRSA.getCarriedKeyName().getValue(), multicastKeyNameValue,
+        CarriedKeyName carried = encKeyRSA.getCarriedKeyName();
+        assert carried != null;
+        Assert.assertEquals(carried.getValue(), multicastKeyNameValue,
                 "EncrypteKey CarriedKeyName had incorrect value");
         
         Assert.assertEquals(encKeyAES.getRecipient(), expectedRecipientAES,
                 "EncryptedKey recipient attribute had invalid value");
-        Assert.assertNotNull(encKeyAES.getReferenceList(), "EncryptedKey ReferenceList was null");
-        Assert.assertEquals(encKeyAES.getReferenceList().getDataReferences().size(), 1,
+        reflist = encKeyAES.getReferenceList();
+        assert reflist != null;
+        Assert.assertEquals(reflist.getDataReferences().size(), 1,
                 "EncryptedKey contained invalid number DataReferences");
-        dr = encKeyAES.getReferenceList().getDataReferences().get(0);
+        dr = reflist.getDataReferences().get(0);
         Assert.assertEquals(dr.getURI(),
                 "#" + encData.getID(), "EncryptedKey DataReference had incorrect URI value");
-        Assert.assertNotNull(encKeyAES.getCarriedKeyName(), "EncryptedKey CarriedKeyName wasn't null");
-        Assert.assertEquals(encKeyAES.getCarriedKeyName().getValue(), multicastKeyNameValue,
+        carried = encKeyAES.getCarriedKeyName();
+        assert carried != null;
+        Assert.assertEquals(carried.getValue(), multicastKeyNameValue,
                 "EncrypteKey CarriedKeyName had incorrect value");
     }
     
@@ -343,7 +362,7 @@ public class ComplexEncryptionTest extends XMLObjectBaseTestCase {
         XMLObject encObject = null;
         try {
             encObject = encrypter.encrypt(target);
-        } catch (EncryptionException e) {
+        } catch (final EncryptionException e) {
             Assert.fail("Object encryption failed: " + e);
         }
         
@@ -354,7 +373,7 @@ public class ComplexEncryptionTest extends XMLObjectBaseTestCase {
         XMLObject encObject2 = null;
         try {
             encObject2 = encrypter.encrypt(target2);
-        } catch (EncryptionException e) {
+        } catch (final EncryptionException e) {
             Assert.fail("Object encryption failed: " + e);
         }
         
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/encryption/tests/SimpleEncryptionTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/encryption/tests/SimpleEncryptionTest.java
index 2bf0088a0..f4cebd8a5 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/encryption/tests/SimpleEncryptionTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/encryption/tests/SimpleEncryptionTest.java
@@ -33,10 +33,13 @@ import org.opensaml.saml.saml2.core.EncryptedID;
 import org.opensaml.saml.saml2.core.NameID;
 import org.opensaml.saml.saml2.core.NewEncryptedID;
 import org.opensaml.saml.saml2.core.NewID;
+import org.opensaml.saml.saml2.core.Subject;
 import org.opensaml.saml.saml2.encryption.Encrypter;
 import org.opensaml.xmlsec.algorithm.AlgorithmSupport;
 import org.opensaml.xmlsec.encryption.support.EncryptionConstants;
 import org.opensaml.xmlsec.encryption.support.EncryptionException;
+import org.opensaml.xmlsec.encryption.EncryptedData;
+import org.opensaml.xmlsec.encryption.EncryptionMethod;
 import org.opensaml.xmlsec.encryption.support.DataEncryptionParameters;
 import org.opensaml.xmlsec.encryption.support.KeyEncryptionParameters;
 import org.opensaml.xmlsec.keyinfo.impl.StaticKeyInfoGenerator;
@@ -93,9 +96,9 @@ public class SimpleEncryptionTest extends XMLObjectBaseTestCase {
      */
     @Test
     public void testAssertion() {
-        Assertion target = (Assertion) unmarshallElement("/org/opensaml/saml/saml2/encryption/Assertion.xml");
+        final Assertion target = (Assertion) unmarshallElement("/org/opensaml/saml/saml2/encryption/Assertion.xml");
         
-        KeyName keyName = (KeyName) buildXMLObject(org.opensaml.xmlsec.signature.KeyName.DEFAULT_ELEMENT_NAME);
+        final KeyName keyName = (KeyName) buildXMLObject(org.opensaml.xmlsec.signature.KeyName.DEFAULT_ELEMENT_NAME);
         keyName.setValue(expectedKeyName);
         keyInfo.getKeyNames().add(keyName);
         encParams.setKeyInfoGenerator(new StaticKeyInfoGenerator(keyInfo));
@@ -105,6 +108,7 @@ public class SimpleEncryptionTest extends XMLObjectBaseTestCase {
         EncryptedAssertion encTarget = null;
         XMLObject encObject = null;
         try {
+            assert target != null;
             encObject = encrypter.encrypt(target);
         } catch (EncryptionException e) {
             Assert.fail("Object encryption failed: " + e);
@@ -114,18 +118,24 @@ public class SimpleEncryptionTest extends XMLObjectBaseTestCase {
         Assert.assertTrue(encObject instanceof EncryptedAssertion, 
                 "Encrypted object was not an instance of the expected type");
         encTarget = (EncryptedAssertion) encObject;
-        
-        Assert.assertEquals(encTarget.getEncryptedData().getType(), EncryptionConstants.TYPE_ELEMENT, "Type attribute");
-        Assert.assertEquals(encTarget.getEncryptedData().getEncryptionMethod().getAlgorithm(), algoURI, 
+        assert encTarget != null;
+        final EncryptedData encData = encTarget.getEncryptedData();
+        assert encData != null;
+        
+        Assert.assertEquals(encData.getType(), EncryptionConstants.TYPE_ELEMENT, "Type attribute");
+        final EncryptionMethod method = encData.getEncryptionMethod();
+        assert method != null;
+        Assert.assertEquals(method.getAlgorithm(), algoURI, 
                 "Algorithm attribute");
-        Assert.assertNotNull(encTarget.getEncryptedData().getKeyInfo(), "KeyInfo");
-        Assert.assertEquals(encTarget.getEncryptedData().getKeyInfo().getKeyNames().get(0).getValue(), expectedKeyName, 
+        final KeyInfo keyInfo = encData.getKeyInfo();
+        assert keyInfo != null;
+        Assert.assertEquals(keyInfo.getKeyNames().get(0).getValue(), expectedKeyName, 
                 "KeyName");
         
-        Assert.assertEquals(encTarget.getEncryptedData().getKeyInfo().getEncryptedKeys().size(), 0, 
+        Assert.assertEquals(keyInfo.getEncryptedKeys().size(), 0, 
                 "Number of EncryptedKeys");
         
-        Assert.assertFalse(Strings.isNullOrEmpty(encTarget.getEncryptedData().getID()),
+        Assert.assertFalse(Strings.isNullOrEmpty(encData.getID()),
                 "EncryptedData ID attribute was empty");
     }
     
@@ -135,9 +145,9 @@ public class SimpleEncryptionTest extends XMLObjectBaseTestCase {
      */
     @Test
     public void testAssertionAsID() {
-        Assertion target = (Assertion) unmarshallElement("/org/opensaml/saml/saml2/encryption/Assertion.xml");
+        final Assertion target = (Assertion) unmarshallElement("/org/opensaml/saml/saml2/encryption/Assertion.xml");
         
-        KeyName keyName = (KeyName) buildXMLObject(org.opensaml.xmlsec.signature.KeyName.DEFAULT_ELEMENT_NAME);
+        final KeyName keyName = (KeyName) buildXMLObject(org.opensaml.xmlsec.signature.KeyName.DEFAULT_ELEMENT_NAME);
         keyName.setValue(expectedKeyName);
         keyInfo.getKeyNames().add(keyName);
         encParams.setKeyInfoGenerator(new StaticKeyInfoGenerator(keyInfo));
@@ -147,6 +157,7 @@ public class SimpleEncryptionTest extends XMLObjectBaseTestCase {
         EncryptedID encTarget = null;
         XMLObject encObject = null;
         try {
+            assert target != null;
             encObject = encrypter.encryptAsID(target);
         } catch (EncryptionException e) {
             Assert.fail("Object encryption failed: " + e);
@@ -156,18 +167,23 @@ public class SimpleEncryptionTest extends XMLObjectBaseTestCase {
         Assert.assertTrue(encObject instanceof EncryptedID, 
                 "Encrypted object was not an instance of the expected type");
         encTarget = (EncryptedID) encObject;
-        
-        Assert.assertEquals(encTarget.getEncryptedData().getType(), EncryptionConstants.TYPE_ELEMENT, "Type attribute");
-        Assert.assertEquals(encTarget.getEncryptedData().getEncryptionMethod().getAlgorithm(), algoURI, 
-                "Algorithm attribute");
-        Assert.assertNotNull(encTarget.getEncryptedData().getKeyInfo(), "KeyInfo");
-        Assert.assertEquals(encTarget.getEncryptedData().getKeyInfo().getKeyNames().get(0).getValue(), expectedKeyName, 
+        assert encTarget != null;
+        final EncryptedData encData = encTarget.getEncryptedData();
+        assert encData != null;
+        
+        Assert.assertEquals(encData.getType(), EncryptionConstants.TYPE_ELEMENT, "Type attribute");
+        final EncryptionMethod method = encData.getEncryptionMethod();
+        assert method != null;
+        Assert.assertEquals(method.getAlgorithm(), algoURI, "Algorithm attribute");
+        final KeyInfo keyInfo = encData.getKeyInfo();
+        assert keyInfo != null;
+        Assert.assertEquals(keyInfo.getKeyNames().get(0).getValue(), expectedKeyName, 
                 "KeyName");
         
-        Assert.assertEquals(encTarget.getEncryptedData().getKeyInfo().getEncryptedKeys().size(), 0, 
+        Assert.assertEquals(keyInfo.getEncryptedKeys().size(), 0, 
                 "Number of EncryptedKeys");
         
-        Assert.assertFalse(Strings.isNullOrEmpty(encTarget.getEncryptedData().getID()),
+        Assert.assertFalse(Strings.isNullOrEmpty(encData.getID()),
                 "EncryptedData ID attribute was empty");
     }
     
@@ -177,10 +193,13 @@ public class SimpleEncryptionTest extends XMLObjectBaseTestCase {
      */
     @Test
     public void testNameID() {
-        Assertion assertion = (Assertion) unmarshallElement("/org/opensaml/saml/saml2/encryption/Assertion.xml");
-        NameID target = assertion.getSubject().getNameID();
+        final Assertion assertion = (Assertion) unmarshallElement("/org/opensaml/saml/saml2/encryption/Assertion.xml");
+        assert assertion != null;
+        final Subject sub = assertion.getSubject();
+        assert sub != null;
+        final NameID target = sub.getNameID();
         
-        KeyName keyName = (KeyName) buildXMLObject(org.opensaml.xmlsec.signature.KeyName.DEFAULT_ELEMENT_NAME);
+        final KeyName keyName = (KeyName) buildXMLObject(org.opensaml.xmlsec.signature.KeyName.DEFAULT_ELEMENT_NAME);
         keyName.setValue(expectedKeyName);
         keyInfo.getKeyNames().add(keyName);
         encParams.setKeyInfoGenerator(new StaticKeyInfoGenerator(keyInfo));
@@ -190,6 +209,7 @@ public class SimpleEncryptionTest extends XMLObjectBaseTestCase {
         EncryptedID encTarget = null;
         XMLObject encObject = null;
         try {
+            assert target != null;
             encObject = encrypter.encrypt(target);
         } catch (EncryptionException e) {
             Assert.fail("Object encryption failed: " + e);
@@ -199,18 +219,23 @@ public class SimpleEncryptionTest extends XMLObjectBaseTestCase {
         Assert.assertTrue(encObject instanceof EncryptedID, 
                 "Encrypted object was not an instance of the expected type");
         encTarget = (EncryptedID) encObject;
-        
-        Assert.assertEquals(encTarget.getEncryptedData().getType(), EncryptionConstants.TYPE_ELEMENT, "Type attribute");
-        Assert.assertEquals(encTarget.getEncryptedData().getEncryptionMethod().getAlgorithm(), algoURI, 
-                "Algorithm attribute");
-        Assert.assertNotNull(encTarget.getEncryptedData().getKeyInfo(), "KeyInfo");
-        Assert.assertEquals(encTarget.getEncryptedData().getKeyInfo().getKeyNames().get(0).getValue(), expectedKeyName, 
+        assert encTarget != null;
+        final EncryptedData encData = encTarget.getEncryptedData();
+        assert encData != null;
+        
+        Assert.assertEquals(encData.getType(), EncryptionConstants.TYPE_ELEMENT, "Type attribute");
+        final EncryptionMethod method = encData.getEncryptionMethod();
+        assert method != null;
+        Assert.assertEquals(method.getAlgorithm(), algoURI, "Algorithm attribute");
+        final KeyInfo keyInfo = encData.getKeyInfo();
+        assert keyInfo != null;
+        Assert.assertEquals(keyInfo.getKeyNames().get(0).getValue(), expectedKeyName, 
                 "KeyName");
         
-        Assert.assertEquals(encTarget.getEncryptedData().getKeyInfo().getEncryptedKeys().size(), 0, 
+        Assert.assertEquals(keyInfo.getEncryptedKeys().size(), 0, 
                 "Number of EncryptedKeys");
         
-        Assert.assertFalse(Strings.isNullOrEmpty(encTarget.getEncryptedData().getID()),
+        Assert.assertFalse(Strings.isNullOrEmpty(encData.getID()),
                 "EncryptedData ID attribute was empty");
     }
     
@@ -220,8 +245,9 @@ public class SimpleEncryptionTest extends XMLObjectBaseTestCase {
      */
     @Test
     public void testAttribute() {
-        Assertion assertion = (Assertion) unmarshallElement("/org/opensaml/saml/saml2/encryption/Assertion.xml");
-        Attribute target = assertion.getAttributeStatements().get(0).getAttributes().get(0);
+        final Assertion assertion = (Assertion) unmarshallElement("/org/opensaml/saml/saml2/encryption/Assertion.xml");
+        assert assertion != null;
+        final Attribute target = assertion.getAttributeStatements().get(0).getAttributes().get(0);
         
         
         KeyName keyName = (KeyName) buildXMLObject(org.opensaml.xmlsec.signature.KeyName.DEFAULT_ELEMENT_NAME);
@@ -243,18 +269,23 @@ public class SimpleEncryptionTest extends XMLObjectBaseTestCase {
         Assert.assertTrue(encObject instanceof EncryptedAttribute, 
                 "Encrypted object was not an instance of the expected type");
         encTarget = (EncryptedAttribute) encObject;
-        
-        Assert.assertEquals(encTarget.getEncryptedData().getType(), EncryptionConstants.TYPE_ELEMENT, "Type attribute");
-        Assert.assertEquals(encTarget.getEncryptedData().getEncryptionMethod().getAlgorithm(), algoURI, 
-                "Algorithm attribute");
-        Assert.assertNotNull(encTarget.getEncryptedData().getKeyInfo(), "KeyInfo");
-        Assert.assertEquals(encTarget.getEncryptedData().getKeyInfo().getKeyNames().get(0).getValue(), expectedKeyName, 
+        assert encTarget != null;
+        final EncryptedData encData = encTarget.getEncryptedData();
+        assert encData != null;
+        
+        Assert.assertEquals(encData.getType(), EncryptionConstants.TYPE_ELEMENT, "Type attribute");
+        final EncryptionMethod method = encData.getEncryptionMethod();
+        assert method != null;
+        Assert.assertEquals(method.getAlgorithm(), algoURI, "Algorithm attribute");
+        final KeyInfo keyInfo = encData.getKeyInfo();
+        assert keyInfo != null;
+        Assert.assertEquals(keyInfo.getKeyNames().get(0).getValue(), expectedKeyName, 
                 "KeyName");
         
-        Assert.assertEquals(encTarget.getEncryptedData().getKeyInfo().getEncryptedKeys().size(), 0, 
+        Assert.assertEquals(keyInfo.getEncryptedKeys().size(), 0, 
                 "Number of EncryptedKeys");
         
-        Assert.assertFalse(Strings.isNullOrEmpty(encTarget.getEncryptedData().getID()),
+        Assert.assertFalse(Strings.isNullOrEmpty(encData.getID()),
                 "EncryptedData ID attribute was empty");
     }
     
@@ -264,10 +295,10 @@ public class SimpleEncryptionTest extends XMLObjectBaseTestCase {
      */
     @Test
     public void testNewID() {
-        NewID target = (NewID) buildXMLObject(NewID.DEFAULT_ELEMENT_NAME);
+        final NewID target = (NewID) buildXMLObject(NewID.DEFAULT_ELEMENT_NAME);
         target.setValue("SomeNewID");
         
-        KeyName keyName = (KeyName) buildXMLObject(org.opensaml.xmlsec.signature.KeyName.DEFAULT_ELEMENT_NAME);
+        final KeyName keyName = (KeyName) buildXMLObject(org.opensaml.xmlsec.signature.KeyName.DEFAULT_ELEMENT_NAME);
         keyName.setValue(expectedKeyName);
         keyInfo.getKeyNames().add(keyName);
         encParams.setKeyInfoGenerator(new StaticKeyInfoGenerator(keyInfo));
@@ -286,18 +317,23 @@ public class SimpleEncryptionTest extends XMLObjectBaseTestCase {
         Assert.assertTrue(encObject instanceof NewEncryptedID, 
                 "Encrypted object was not an instance of the expected type");
         encTarget = (NewEncryptedID) encObject;
-        
-        Assert.assertEquals(encTarget.getEncryptedData().getType(), EncryptionConstants.TYPE_ELEMENT, "Type attribute");
-        Assert.assertEquals(encTarget.getEncryptedData().getEncryptionMethod().getAlgorithm(), algoURI, 
-                "Algorithm attribute");
-        Assert.assertNotNull(encTarget.getEncryptedData().getKeyInfo(), "KeyInfo");
-        Assert.assertEquals(encTarget.getEncryptedData().getKeyInfo().getKeyNames().get(0).getValue(), expectedKeyName, 
+        assert encTarget != null;
+        final EncryptedData encData = encTarget.getEncryptedData();
+        assert encData != null;
+        
+        Assert.assertEquals(encData.getType(), EncryptionConstants.TYPE_ELEMENT, "Type attribute");
+        final EncryptionMethod method = encData.getEncryptionMethod();
+        assert method != null;
+        Assert.assertEquals(method.getAlgorithm(), algoURI, "Algorithm attribute");
+        final KeyInfo keyInfo = encData.getKeyInfo();
+        assert keyInfo != null;
+        Assert.assertEquals(keyInfo.getKeyNames().get(0).getValue(), expectedKeyName, 
                 "KeyName");
         
-        Assert.assertEquals(encTarget.getEncryptedData().getKeyInfo().getEncryptedKeys().size(), 0, 
+        Assert.assertEquals(keyInfo.getEncryptedKeys().size(), 0, 
                 "Number of EncryptedKeys");
         
-        Assert.assertFalse(Strings.isNullOrEmpty(encTarget.getEncryptedData().getID()),
+        Assert.assertFalse(Strings.isNullOrEmpty(encData.getID()),
                 "EncryptedData ID attribute was empty");
         
     }
@@ -305,12 +341,13 @@ public class SimpleEncryptionTest extends XMLObjectBaseTestCase {
     /** Test that reuse of the encrypter with the same encryption and key encryption parameters is allowed. */
     @Test
     public void testReuse() {
-        Assertion assertion = (Assertion) unmarshallElement("/org/opensaml/saml/saml2/encryption/Assertion.xml");
+        final Assertion assertion = (Assertion) unmarshallElement("/org/opensaml/saml/saml2/encryption/Assertion.xml");
+        assert assertion != null;
         
-        Attribute target = assertion.getAttributeStatements().get(0).getAttributes().get(0);
-        Attribute target2 = assertion.getAttributeStatements().get(0).getAttributes().get(1);
+        final Attribute target = assertion.getAttributeStatements().get(0).getAttributes().get(0);
+        final Attribute target2 = assertion.getAttributeStatements().get(0).getAttributes().get(1);
         
-        KeyName keyName = (KeyName) buildXMLObject(org.opensaml.xmlsec.signature.KeyName.DEFAULT_ELEMENT_NAME);
+        final KeyName keyName = (KeyName) buildXMLObject(org.opensaml.xmlsec.signature.KeyName.DEFAULT_ELEMENT_NAME);
         keyName.setValue(expectedKeyName);
         keyInfo.getKeyNames().add(keyName);
         encParams.setKeyInfoGenerator(new StaticKeyInfoGenerator(keyInfo));
@@ -343,7 +380,7 @@ public class SimpleEncryptionTest extends XMLObjectBaseTestCase {
     /** Test that a data encryption key is auto-generated if it is not supplied. */
     @Test
     public void testAutoKeyGen() {
-        Assertion target = (Assertion) unmarshallElement("/org/opensaml/saml/saml2/encryption/Assertion.xml");
+        final Assertion target = (Assertion) unmarshallElement("/org/opensaml/saml/saml2/encryption/Assertion.xml");
         
         encParams.setEncryptionCredential(null);
         
@@ -353,6 +390,7 @@ public class SimpleEncryptionTest extends XMLObjectBaseTestCase {
         
         XMLObject encObject = null;
         try {
+            assert target != null;
             encObject = encrypter.encrypt(target);
         } catch (EncryptionException e) {
             Assert.fail("Object encryption failed: " + e);
@@ -366,7 +404,7 @@ public class SimpleEncryptionTest extends XMLObjectBaseTestCase {
     /** Test that an error is thrown if the no data encryption credential is supplied and no KEK is specified. */
     @Test
     public void testAutoKeyGenNoKEK() {
-        Assertion target = (Assertion) unmarshallElement("/org/opensaml/saml/saml2/encryption/Assertion.xml");
+        final Assertion target = (Assertion) unmarshallElement("/org/opensaml/saml/saml2/encryption/Assertion.xml");
         
         encParams.setEncryptionCredential(null);
         
@@ -375,6 +413,7 @@ public class SimpleEncryptionTest extends XMLObjectBaseTestCase {
         encrypter = new Encrypter(encParams, kekParamsList);
         
         try {
+            assert target != null;
             encrypter.encrypt(target);
             Assert.fail("Object encryption should have failed: no KEK supplied with auto key generation for data encryption");
         } catch (EncryptionException e) {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list