[java-shib-attribute] branch main updated: Remove null-violation tests.

Scott Cantor cantor.2 at osu.edu
Tue Nov 22 13:55:34 UTC 2022


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

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

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-attribute.git;a=commit;h=b3707d6c44981f8f371565fa22effc88b2adb71a

The following commit(s) were added to refs/heads/main by this push:
     new b3707d6c4 Remove null-violation tests.
b3707d6c4 is described below

commit b3707d6c44981f8f371565fa22effc88b2adb71a
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Nov 22 08:55:32 2022 -0500

    Remove null-violation tests.
---
 .../java/net/shibboleth/idp/attribute/AttributeTest.java   | 13 ++-----------
 .../shibboleth/idp/attribute/ByteAttributeValueTest.java   | 10 +---------
 .../shibboleth/idp/attribute/EmptyAttributeValueTest.java  |  9 ---------
 .../idp/attribute/ScopedStringAttributeValueTest.java      | 14 --------------
 .../shibboleth/idp/attribute/StringAttributeValueTest.java |  7 -------
 .../idp/attribute/XMLObjectAttributeValueTest.java         |  9 ---------
 6 files changed, 3 insertions(+), 59 deletions(-)

diff --git a/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/AttributeTest.java b/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/AttributeTest.java
index de3ab9ff7..94395d664 100644
--- a/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/AttributeTest.java
+++ b/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/AttributeTest.java
@@ -54,15 +54,8 @@ public class AttributeTest extends OpenSAMLInitBaseTestCase{
         Assert.assertTrue(attrib.equals(new IdPAttribute("foo")));
     }
 
-    /** Tests that null/empty IDs aren't accepted. */
-    @Test public void nullEmptyId() {
-        try {
-            new IdPAttribute(null);
-            Assert.fail("able to create attribute with null ID");
-        } catch (ConstraintViolationException e) {
-            // expected this
-        }
-
+    /** Tests that empty IDs aren't accepted. */
+    @Test public void emptyId() {
         try {
             new IdPAttribute("");
             Assert.fail("able to create attribute with empty ID");
@@ -83,8 +76,6 @@ public class AttributeTest extends OpenSAMLInitBaseTestCase{
         } catch (ConstraintViolationException e) {
             // expected this
         }
-
-        
     }
 
 
diff --git a/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/ByteAttributeValueTest.java b/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/ByteAttributeValueTest.java
index e91430e58..9371117a8 100644
--- a/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/ByteAttributeValueTest.java
+++ b/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/ByteAttributeValueTest.java
@@ -24,7 +24,6 @@ import javax.annotation.Nonnull;
 import net.shibboleth.shared.codec.Base64Support;
 import net.shibboleth.shared.codec.DecodingException;
 import net.shibboleth.shared.codec.EncodingException;
-import net.shibboleth.shared.logic.ConstraintViolationException;
 
 import org.testng.Assert;
 import org.testng.annotations.Test;
@@ -39,15 +38,8 @@ public class ByteAttributeValueTest {
     
     /** Test proper instantiation of the object. */
     @Test public void instantiation() {
-        ByteAttributeValue value = new ByteAttributeValue(DATA1);
+        final ByteAttributeValue value = new ByteAttributeValue(DATA1);
         Assert.assertEquals(value.getValue(), DATA1);
-
-        try {
-            new ByteAttributeValue(null);
-            Assert.fail("able to set null attribute value");
-        } catch (ConstraintViolationException e) {
-            // expected this
-        }
     }
 
     /** Test equality of two objects. */
diff --git a/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/EmptyAttributeValueTest.java b/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/EmptyAttributeValueTest.java
index 12d7db2cc..d88ed7a65 100644
--- a/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/EmptyAttributeValueTest.java
+++ b/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/EmptyAttributeValueTest.java
@@ -18,7 +18,6 @@
 package net.shibboleth.idp.attribute;
 
 import net.shibboleth.idp.attribute.EmptyAttributeValue.EmptyType;
-import net.shibboleth.shared.logic.ConstraintViolationException;
 
 import org.testng.Assert;
 import org.testng.annotations.Test;
@@ -30,14 +29,6 @@ public class EmptyAttributeValueTest {
     @Test public void instantiation() {
         final EmptyAttributeValue value = new EmptyAttributeValue(EmptyType.NULL_VALUE);
         Assert.assertEquals(value.getValue(), EmptyType.NULL_VALUE);
-
-        try {
-            new EmptyAttributeValue(null);
-            Assert.fail("able to set null attribute value");
-        } catch (ConstraintViolationException e) {
-            // expected this
-        }
-
     }
 
     /** Test equality of two objects. */
diff --git a/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/ScopedStringAttributeValueTest.java b/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/ScopedStringAttributeValueTest.java
index addb74895..e42f74ab7 100644
--- a/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/ScopedStringAttributeValueTest.java
+++ b/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/ScopedStringAttributeValueTest.java
@@ -31,13 +31,6 @@ public class ScopedStringAttributeValueTest {
         Assert.assertEquals(value.getValue(), " foo ");
         Assert.assertEquals(value.getScope(), "bar");
 
-        try {
-            new ScopedStringAttributeValue(null, "bar");
-            Assert.fail("able to set null attribute value");
-        } catch (ConstraintViolationException e) {
-            // expected this
-        }
-
         try {
             new ScopedStringAttributeValue("", "bar");
             Assert.fail("able to set empty attribute value");
@@ -45,13 +38,6 @@ public class ScopedStringAttributeValueTest {
             // expected this
         }
 
-        try {
-            new ScopedStringAttributeValue("foo", null);
-            Assert.fail("able to set null attribute scope");
-        } catch (ConstraintViolationException e) {
-            // expected this
-        }
-
         try {
             new ScopedStringAttributeValue("foo", "");
             Assert.fail("able to set empty attribute scope");
diff --git a/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/StringAttributeValueTest.java b/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/StringAttributeValueTest.java
index ba55c2af5..b50b2022b 100644
--- a/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/StringAttributeValueTest.java
+++ b/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/StringAttributeValueTest.java
@@ -30,13 +30,6 @@ public class StringAttributeValueTest {
         final StringAttributeValue value = new StringAttributeValue(" foo ");
         Assert.assertEquals(value.getValue(), " foo ");
 
-        try {
-            new StringAttributeValue(null);
-            Assert.fail("able to set null attribute value");
-        } catch (ConstraintViolationException e) {
-            // expected this
-        }
-
         try {
             new StringAttributeValue("");
             Assert.fail("able to set empty attribute value");
diff --git a/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/XMLObjectAttributeValueTest.java b/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/XMLObjectAttributeValueTest.java
index 7999a4414..fb14b30a3 100644
--- a/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/XMLObjectAttributeValueTest.java
+++ b/shib-attribute-api/src/test/java/net/shibboleth/idp/attribute/XMLObjectAttributeValueTest.java
@@ -27,8 +27,6 @@ import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-import net.shibboleth.shared.logic.ConstraintViolationException;
-
 /** Unit test for {@link XMLObjectAttributeValue}. */
 public class XMLObjectAttributeValueTest extends XMLObjectBaseTestCase {
     
@@ -55,13 +53,6 @@ public class XMLObjectAttributeValueTest extends XMLObjectBaseTestCase {
     @Test public void instantiation() {
         final XMLObjectAttributeValue value = new XMLObjectAttributeValue(xsId1);
         Assert.assertEquals(value.getValue(), xsId1);
-
-        try {
-            new XMLObjectAttributeValue(null);
-            Assert.fail("able to set null attribute value");
-        } catch (ConstraintViolationException e) {
-            // expected this
-        }
     }
 
     /** Test equality of two objects. */

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


More information about the commits mailing list