aboutsummaryrefslogtreecommitdiff
path: root/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java')
-rw-r--r--id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java1448
1 files changed, 739 insertions, 709 deletions
diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java
index 7052b320a..7800e78b5 100644
--- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java
+++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java
@@ -22,726 +22,756 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import eu.stork.peps.auth.commons.IPersonalAttributeList;
import eu.stork.peps.auth.commons.PersonalAttribute;
import eu.stork.peps.auth.commons.PersonalAttributeList;
import eu.stork.peps.auth.commons.STORKStatusCode;
/**
* The PersonalAttributeList's Test Case.
- *
+ *
* @author ricardo.ferreira@multicert.com, renato.portela@multicert.com,
- * luis.felix@multicert.com, hugo.magalhaes@multicert.com,
- * paulo.ribeiro@multicert.com
+ * luis.felix@multicert.com, hugo.magalhaes@multicert.com,
+ * paulo.ribeiro@multicert.com
* @version $Revision: 1.5 $, $Date: 2010-11-17 05:17:02 $
*/
public final class PersonalAttributeListTestCase {
-
- /**
- * isAgeOver constant value.
- */
- private static final String ISAGEOVER_CONS = "isAgeOver";
-
- /**
- * 1 constant value.
- */
- private static final int ONE_CONS = 1;
-
- /**
- * 2 constant value.
- */
- private static final int TWO_CONS = 2;
-
- /**
- * An empty attribute.
- */
- @SuppressWarnings("unused")
- private static final PersonalAttributeList EMPTY_ATTR_LIST =
- new PersonalAttributeList(0);
-
- /**
- * An attribute with a complex value (canonicalResidenceAddress).
- */
- private static PersonalAttribute complexAttrValue = null;
-
- /**
- * Simple attribute value list string.
- */
- private static final String SIMPLE_ATTRLIST =
- "isAgeOver:true:[15,]:Available;";
-
- /**
- * Simple attribute value list string.
- */
- private static final String SIMPLE_ATTRLIST2 =
- "isAgeOver:true:[18,]:Available;";
-
- /**
- * Simple attribute value list string.
- */
- private static final String SIMPLE_ATTRLIST3 =
- "isAgeOver:true:[15,]:Available;isAgeOver:true:[18,]:Available;";
-
- /**
- * Simple attribute value list string.
- */
- private static final String SIMPLE_ATTRLIST3_REVERSE =
- "isAgeOver:true:[18,]:Available;isAgeOver:true:[15,]:Available;";
- /**
- * Simple attribute value list string.
- */
- private static final String COMPLEX_ATTRLIST =
- "canonicalResidenceAddress:true:[postalCode=4100,apartmentNumber=Ed. B,"
- + "state=Porto,countryCodeAddress=PT,streetNumber=379,"
- + "streetName=Avenida Sidonio Pais,town=Porto,]:Available;";
- /**
- * Mix attribute list string.
- */
- private static final String STR_MIX_ATTR_LIST =
- "isAgeOver:true:[15,]:Available;canonicalResidenceAddress:true:["
- + "postalCode=4100,apartmentNumber=Ed.B,state=Porto,countryCodeAddress=PT,"
- + "streetNumber=379,streetName=Avenida Sidonio Pais,town=Porto,]:"
- + "Available;";
-
- /**
- * Mix attribute list 2 string.
- */
- private static final String STR_MIX_ATTR_LIST2 =
- "isAgeOver:true:[15,]:Available;canonicalResidenceAddress:true:["
- + "postalCode=4100,apartmentNumber=Ed.B,state=Porto,countryCodeAddress=PT,"
- + "streetNumber=379,streetName=Avenida Sidonio Pais,town=Porto,]:Available;"
- + "mandateContent:true:["
- + "isJoint=\"isjoint\",typeOfPower=\"power\",ValidTo=\"validto\",validfrom=\"validfrom\",AQAA=\"3\",isChained=\"ischained\",]:"
- + "Available;";
-
- /**
- * Attribute List example.
- */
- @SuppressWarnings({ "serial" })
- private static final PersonalAttribute ATTR_VALUE = new PersonalAttribute(
- "age", true, new ArrayList<String>() {
- {
- add("15");
- }
- }, STORKStatusCode.STATUS_AVAILABLE.toString());
-
- /**
- * Init PersonalAttributeListTestCase class.
- */
- @SuppressWarnings("serial")
- @BeforeClass
- public static void runsBeforeTheTestSuite() {
- final Map<String, String> values = new HashMap<String, String>() {
- {
- put("countryCodeAddress", "PT");
- put("state", "Porto");
- put("town", "Porto");
- put("postalCode", "4100");
- put("streetName", "Avenida Sidonio Pais");
- put("streetNumber", "379");
- put("apartmentNumber", "Ed. B");
- }
- };
-
- complexAttrValue =
- new PersonalAttribute("canonicalResidenceAddress", true, values,
- STORKStatusCode.STATUS_AVAILABLE.toString());
-
- }
-
- /**
- * Testing Personal Attribute List add method. Personal Attribute list must be
- * size 1 - Simple attribute.
- */
- @Test
- public void testAddSimpleAttr() {
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.add(ATTR_VALUE);
- Assert.assertTrue(attrList.size() == 1);
- }
-
- /**
- * Testing Personal Attribute List add method. Personal Attribute list must be
- * size 1 - Complex attribute.
- */
- @Test
- public void testAddCompleAttr() {
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.add(complexAttrValue);
- Assert.assertTrue(attrList.size() == 1);
- }
-
- /**
- * Testing Personal Attribute List add method. Personal Attribute list must be
- * size 0 - no attribute.
- */
- @Test
- public void testAddNull() {
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.add(null);
- Assert.assertTrue(attrList.size() == 0);
- }
-
- /**
- * Testing Personal Attribute List add method. Same attribute name added
- * twice. Personal Attribute list must be size 2 - IsAgeOver attribute added
- * twice.
- */
- @SuppressWarnings("serial")
- @Test
- public void testAddSameAttrName() {
- final PersonalAttribute attrValueUnder =
- new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
- {
- add("15");
- }
- }, STORKStatusCode.STATUS_AVAILABLE.toString());
-
- final PersonalAttribute attrValueOver =
- new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
- {
- add("18");
- }
- }, STORKStatusCode.STATUS_AVAILABLE.toString());
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.add(attrValueUnder);
- attrList.add(attrValueOver);
- Assert.assertTrue(attrList.size() == 2);
- }
-
- /**
- * Testing Personal Attribute List add method. Same attribute name added
- * twice. Personal Attribute list must be size 2 - IsAgeOver attribute added
- * twice.
- */
- @SuppressWarnings("serial")
- @Test
- public void testAddSameAttrNameEmpty() {
- final PersonalAttribute attrValueUnder =
- new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
- {
- add("15");
- }
- }, STORKStatusCode.STATUS_AVAILABLE.toString());
-
- final PersonalAttribute attrValueOver =
- new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
- {
- add("");
- }
- }, STORKStatusCode.STATUS_AVAILABLE.toString());
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.add(attrValueUnder);
- attrList.add(attrValueOver);
- Assert.assertTrue(attrList.size() == 2);
- }
-
- /**
- * Testing Personal Attribute List put method. Personal Attribute list must be
- * size 1 - Simple Value.
- */
- @Test
- public void testPutSimpleAttr() {
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.put(ATTR_VALUE.getName(), ATTR_VALUE);
- Assert.assertTrue(attrList.size() == 1);
- }
-
- /**
- * Testing Personal Attribute List put method. Personal Attribute list must be
- * size 1 - Complex Value.
- */
- @Test
- public void testPutComplexAttr() {
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.put(ATTR_VALUE.getName(), complexAttrValue);
- Assert.assertTrue(attrList.size() == 1);
- }
-
- /**
- * Testing Personal Attribute List put method. Personal Attribute list must be
- * size 0 - no attribute.
- */
- @Test
- public void testPutNull() {
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.put("", null);
- Assert.assertTrue(attrList.size() == 0);
- }
-
- /**
- * Testing Personal Attribute List put method. Personal Attribute list must be
- * size 2 - IsAgeOver attribute added twice.
- */
- @SuppressWarnings("serial")
- @Test
- public void testPutSameAttrName() {
- final PersonalAttribute attrValueUnder =
- new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
- {
- add("15");
- }
- }, STORKStatusCode.STATUS_AVAILABLE.toString());
-
- final PersonalAttribute attrValueOver =
- new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
- {
- add("18");
- }
- }, STORKStatusCode.STATUS_AVAILABLE.toString());
-
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.put(attrValueUnder.getName(), attrValueUnder);
- attrList.put(attrValueOver.getName(), attrValueOver);
- Assert.assertTrue(attrList.size() == 2);
- }
-
- /**
- * Testing Personal Attribute List put method. Personal Attribute list must be
- * size 2 - IsAgeOver attribute added twice.
- */
- @SuppressWarnings("serial")
- @Test
- public void testPutSameAttrNameEmpty() {
- final PersonalAttribute attrValueUnder =
- new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
- {
- add("15");
- }
- }, STORKStatusCode.STATUS_AVAILABLE.toString());
-
- final PersonalAttribute attrValueOver =
- new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
- {
- add("");
- }
- }, STORKStatusCode.STATUS_AVAILABLE.toString());
-
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.put(attrValueUnder.getName(), attrValueUnder);
- attrList.put(attrValueOver.getName(), attrValueOver);
- Assert.assertTrue(attrList.size() == 2);
- }
-
- /**
- * Testing Personal Attribute List get method. Personal Attribute list must be
- * size 1 - Simple attribute.
- */
- @Test
- public void testGetSimpleAttr() {
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.add(ATTR_VALUE);
- Assert.assertEquals(ATTR_VALUE, attrList.get(ATTR_VALUE.getName()));
- }
-
- /**
- * Testing Personal Attribute List add method. Personal Attribute list must be
- * size 1 - Complex attribute.
- */
- @Test
- public void testGetCompleAttr() {
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.add(complexAttrValue);
- Assert.assertEquals(complexAttrValue.toString(),
- attrList.get(complexAttrValue.getName()).toString());
- }
-
- /**
- * Testing Personal Attribute List get method. Personal Attribute list must be
- * size 2 - IsAgeOver attribute.
- */
- @SuppressWarnings("serial")
- @Test
- public void testGetIsAgeOverAttr() {
- final PersonalAttribute attrValueUnder =
- new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
- {
- add("15");
- }
- }, STORKStatusCode.STATUS_AVAILABLE.toString());
-
- final PersonalAttribute attrValueOver =
- new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
- {
- add("18");
- }
- }, STORKStatusCode.STATUS_AVAILABLE.toString());
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.add(attrValueUnder);
- attrList.add(attrValueOver);
- Assert.assertEquals(SIMPLE_ATTRLIST,
- attrList.get(attrValueUnder.getName()).toString());
- Assert.assertEquals(SIMPLE_ATTRLIST2,
- attrList.get(attrValueOver.getName()).toString());
- }
-
- /**
- * Testing Personal Attribute List populate method. Personal Attribute list
- * must be size 1 - Simple attribute.
- */
- @Test
- public void testPopulateSimpleAttr() {
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.populate(SIMPLE_ATTRLIST);
- Assert.assertTrue(attrList.size() == 1);
- }
-
- /**
- * Testing Personal Attribute List populate method. Personal Attribute list
- * must be size 1 - Complex attribute.
- */
- @Test
- public void testPopulateComplexAttr() {
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.populate(COMPLEX_ATTRLIST);
- Assert.assertTrue(attrList.size() == 1);
- }
-
- /**
- * Testing Personal Attribute List populate method. Personal Attribute list
- * must be size 1 - Simple and Complex attribute.
- */
- @Test
- public void testPopulateMixAttrs() {
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.populate(STR_MIX_ATTR_LIST);
- Assert.assertTrue(attrList.size() == 2);
- }
-
- /**
- * Testing Personal Attribute List toString method using add.
- */
- @SuppressWarnings("serial")
- @Test
- public void testToStringFromAdd() {
- final PersonalAttribute attrValueUnder =
- new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
- {
- add("15");
- }
- }, STORKStatusCode.STATUS_AVAILABLE.toString());
-
- final PersonalAttribute attrValueOver =
- new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
- {
- add("18");
- }
- }, STORKStatusCode.STATUS_AVAILABLE.toString());
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.add(attrValueUnder);
- attrList.add(attrValueOver);
- Assert.assertEquals(SIMPLE_ATTRLIST3_REVERSE, attrList.toString());
- }
-
- /**
- * Testing Personal Attribute List toString method using put.
- *
- */
- @SuppressWarnings("serial")
- @Test
- public void testToStringFromPut() {
- final PersonalAttribute attrValueUnder =
- new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
- {
- add("15");
- }
- }, STORKStatusCode.STATUS_AVAILABLE.toString());
-
- final PersonalAttribute attrValueOver =
- new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
- {
- add("18");
- }
- }, STORKStatusCode.STATUS_AVAILABLE.toString());
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.put(attrValueUnder.getName(), attrValueUnder);
- attrList.put(attrValueOver.getName(), attrValueOver);
- Assert.assertEquals(SIMPLE_ATTRLIST3_REVERSE, attrList.toString());
- }
-
- /**
- * Testing Personal Attribute List toString method using populate.
- */
- @Test
- public void testToStringFromSimplePopulate() {
- final String strAttrList = "isAgeOver:true";
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.populate(strAttrList);
- Assert.assertEquals("isAgeOver:true:[]:;", attrList.toString());
- }
-
- /**
- * Testing Personal Attribute List toString method using populate.
- */
- @Test
- public void testToStringFromPopulate() {
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.populate(SIMPLE_ATTRLIST3);
- Assert.assertEquals(SIMPLE_ATTRLIST3_REVERSE, attrList.toString());
- }
-
- /**
- * Testing Personal Attribute List populate method, with invalid values.
- */
- @Test
- public void testPopulateWithInvalidValuesFormat() {
- final PersonalAttributeList pal = new PersonalAttributeList();
- pal.populate("name:type:values:status;");
- Assert.assertEquals(pal, new PersonalAttributeList());
- }
-
- /**
- * Testing Personal Attribute List populate method, with invalid format.
- */
- @Test
- public void testPopulateWithInvalidFormat() {
-
- final PersonalAttributeList pal = new PersonalAttributeList();
- pal.populate("name:type::status;");
- Assert.assertEquals(pal, new PersonalAttributeList());
- }
-
- /**
- * Testing Personal Attribute List clone method using add.
- */
- @SuppressWarnings("serial")
- @Test
- public void testCloneFromAdd() {
- final PersonalAttribute attrValueUnder =
- new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
- {
- add("15");
- }
- }, STORKStatusCode.STATUS_AVAILABLE.toString());
-
- final PersonalAttribute attrValueOver =
- new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
- {
- add("18");
- }
- }, STORKStatusCode.STATUS_AVAILABLE.toString());
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.add(attrValueUnder);
- attrList.add(attrValueOver);
- Assert.assertNotSame(attrList, attrList.clone());
- }
-
- /**
- * Testing Personal Attribute List clone method using put.
- */
- @SuppressWarnings("serial")
- @Test
- public void testCloneFromPut() {
- final PersonalAttribute attrValueUnder =
- new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
- {
- add("15");
- }
- }, STORKStatusCode.STATUS_AVAILABLE.toString());
+
+ /**
+ * isAgeOver constant value.
+ */
+ private static final String ISAGEOVER_CONS = "isAgeOver";
+
+ /**
+ * 1 constant value.
+ */
+ private static final int ONE_CONS = 1;
+
+ /**
+ * 2 constant value.
+ */
+ private static final int TWO_CONS = 2;
+
+ /**
+ * An empty attribute.
+ */
+ @SuppressWarnings("unused")
+ private static final IPersonalAttributeList EMPTY_ATTR_LIST
+ = new PersonalAttributeList(0);
+
+ /**
+ * An attribute with a complex value (canonicalResidenceAddress).
+ */
+ private static PersonalAttribute complexAttrValue = null;
+
+ /**
+ * Simple attribute value list string.
+ */
+ private static final String SIMPLE_ATTRLIST
+ = "isAgeOver:true:[15]:Available;";
+
+ /**
+ * Simple attribute value list string.
+ */
+ private static final String SIMPLE_ATTRLIST2
+ = "isAgeOver:true:[18]:Available;";
+
+ /**
+ * Simple attribute value list string.
+ */
+ private static final String SIMPLE_ATTRLIST3
+ = "isAgeOver:true:[15]:Available;isAgeOver:true:[18]:Available;";
- final PersonalAttribute attrValueOver =
- new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
- {
- add("18");
+ /**
+ * Simple attribute value list string.
+ */
+ private static final String SIMPLE_ATTRLIST4
+ = "isAgeOver:true:[15,18]:Available;";
+
+ /**
+ * Simple attribute value list string.
+ */
+ private static final String SIMPLE_ATTRLIST3_REVERSE
+ = "isAgeOver:true:[18]:Available;isAgeOver:true:[15]:Available;";
+ /**
+ * Simple attribute value list string.
+ */
+ private static final String COMPLEX_ATTRLIST
+ = "canonicalResidenceAddress:true:[postalCode=4100,apartmentNumber=Ed. B,"
+ + "state=Porto,countryCodeAddress=PT,streetNumber=379,"
+ + "streetName=Avenida Sidonio Pais,town=Porto]:Available;";
+ /**
+ * Mix attribute list string.
+ */
+ private static final String STR_MIX_ATTR_LIST
+ = "isAgeOver:true:[15]:Available;canonicalResidenceAddress:true:["
+ + "postalCode=4100,apartmentNumber=Ed.B,state=Porto,countryCodeAddress=PT,"
+ + "streetNumber=379,streetName=Avenida Sidonio Pais,town=Porto]:"
+ + "Available;";
+
+ /**
+ * Mix attribute list 2 string.
+ */
+ private static final String STR_MIX_ATTR_LIST2
+ = "isAgeOver:true:[15]:Available;canonicalResidenceAddress:true:["
+ + "postalCode=4100,apartmentNumber=Ed.B,state=Porto,countryCodeAddress=PT,"
+ + "streetNumber=379,streetName=Avenida Sidonio Pais,town=Porto]:Available;"
+ + "mandateContent:true:["
+ + "isJoint=\"isjoint\",typeOfPower=\"power\",ValidTo=\"validto\",validfrom=\"validfrom\",AQAA=\"3\",isChained=\"ischained\",]:"
+ + "Available;";
+
+ /**
+ * Attribute List example.
+ */
+ @SuppressWarnings({"serial"})
+ private static final PersonalAttribute ATTR_VALUE = new PersonalAttribute(
+ "age", true, new ArrayList<String>() {
+ {
+ add("15");
+ }
+ }, STORKStatusCode.STATUS_AVAILABLE.toString());
+
+ /**
+ * Init PersonalAttributeListTestCase class.
+ */
+ @SuppressWarnings("serial")
+ @BeforeClass
+ public static void runsBeforeTheTestSuite() {
+ final Map<String, String> values = new HashMap<String, String>() {
+ {
+ put("countryCodeAddress", "PT");
+ put("state", "Porto");
+ put("town", "Porto");
+ put("postalCode", "4100");
+ put("streetName", "Avenida Sidonio Pais");
+ put("streetNumber", "379");
+ put("apartmentNumber", "Ed. B");
+ }
+ };
+
+ complexAttrValue
+ = new PersonalAttribute("canonicalResidenceAddress", true, values,
+ STORKStatusCode.STATUS_AVAILABLE.toString());
+
+ }
+
+ /**
+ * Testing Personal Attribute List add method. Personal Attribute list must
+ * be size 1 - Simple attribute.
+ */
+ @Test
+ public void testAddSimpleAttr() {
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.add(ATTR_VALUE);
+ Assert.assertTrue(attrList.size() == 1);
+ }
+
+ /**
+ * Testing Personal Attribute List add method. Personal Attribute list must
+ * be size 1 - Complex attribute.
+ */
+ @Test
+ public void testAddCompleAttr() {
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.add(complexAttrValue);
+ Assert.assertTrue(attrList.size() == 1);
+ }
+
+ /**
+ * Testing Personal Attribute List add method. Personal Attribute list must
+ * be size 0 - no attribute.
+ */
+ @Test
+ public void testAddNull() {
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.add(null);
+ Assert.assertTrue(attrList.size() == 0);
+ }
+
+ /**
+ * Testing Personal Attribute List add method. Same attribute name added
+ * twice. Personal Attribute list must be size 2 - IsAgeOver attribute added
+ * twice.
+ */
+ @SuppressWarnings("serial")
+ @Test
+ public void testAddSameAttrName() {
+ final PersonalAttribute attrValueUnder
+ = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
+ {
+ add("15");
+ }
+ }, STORKStatusCode.STATUS_AVAILABLE.toString());
+
+ final PersonalAttribute attrValueOver
+ = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
+ {
+ add("18");
+ }
+ }, STORKStatusCode.STATUS_AVAILABLE.toString());
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.add(attrValueUnder);
+ attrList.add(attrValueOver);
+ System.out.println();
+ Assert.assertTrue(attrList.get(attrValueOver.getName()).getValue().size() == 2);
+ }
+
+ /**
+ * Testing Personal Attribute List add method. Same attribute name added
+ * twice. Personal Attribute list must be size 2 - IsAgeOver attribute added
+ * twice.
+ */
+ @SuppressWarnings("serial")
+ @Test
+ public void testAddSameAttrNameEmpty() {
+ final PersonalAttribute attrValueUnder
+ = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
+ {
+ add("15");
+ }
+ }, STORKStatusCode.STATUS_AVAILABLE.toString());
+
+ final PersonalAttribute attrValueOver
+ = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
+ {
+ add("");
+ }
+ }, STORKStatusCode.STATUS_AVAILABLE.toString());
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.add(attrValueUnder);
+ attrList.add(attrValueOver);
+ Assert.assertTrue(attrList.size() == 1);
+ Assert.assertTrue(attrList.get(attrValueOver.getName()).getValue().size() == 2);
+ }
+
+ /**
+ * Testing Personal Attribute List put method. Personal Attribute list must
+ * be size 1 - Simple Value.
+ */
+ @Test
+ public void testPutSimpleAttr() {
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.put(ATTR_VALUE.getName(), ATTR_VALUE);
+ Assert.assertTrue(attrList.size() == 1);
+ }
+
+ /**
+ * Testing Personal Attribute List put method. Personal Attribute list must
+ * be size 1 - Complex Value.
+ */
+ @Test
+ public void testPutComplexAttr() {
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.put(ATTR_VALUE.getName(), complexAttrValue);
+ Assert.assertTrue(attrList.size() == 1);
+ }
+
+ /**
+ * Testing Personal Attribute List put method. Personal Attribute list must
+ * be size 0 - no attribute.
+ */
+ @Test(expected = NullPointerException.class)
+ public void testPutNull() {
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.put("", null);
+ Assert.assertTrue(attrList.size() == 0);
+ }
+
+ /**
+ * Testing Personal Attribute List put method. Personal Attribute list must
+ * be size 2 - IsAgeOver attribute added twice.
+ */
+ @SuppressWarnings("serial")
+ @Test
+ public void testPutSameAttrName() {
+ final PersonalAttribute attrValueUnder
+ = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
+ {
+ add("15");
+ }
+ }, STORKStatusCode.STATUS_AVAILABLE.toString());
+
+ final PersonalAttribute attrValueOver
+ = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
+ {
+ add("18");
+ }
+ }, STORKStatusCode.STATUS_AVAILABLE.toString());
+
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.put(attrValueUnder.getName(), attrValueUnder);
+ attrList.put(attrValueOver.getName(), attrValueOver);
+ Assert.assertTrue(attrList.size() == 1);
+ Assert.assertTrue(attrList.get(attrValueOver.getName()).getValue().size() == 2);
+ }
+
+ /**
+ * Testing Personal Attribute List put method. Personal Attribute list must
+ * be size 2 - IsAgeOver attribute added twice.
+ */
+ @SuppressWarnings("serial")
+ @Test
+ public void testPutSameAttrNameEmpty() {
+ final PersonalAttribute attrValueUnder
+ = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
+ {
+ add("15");
+ }
+ }, STORKStatusCode.STATUS_AVAILABLE.toString());
+
+ final PersonalAttribute attrValueOver
+ = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
+ {
+ add("");
+ }
+ }, STORKStatusCode.STATUS_AVAILABLE.toString());
+
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.put(attrValueUnder.getName(), attrValueUnder);
+ attrList.put(attrValueOver.getName(), attrValueOver);
+ Assert.assertTrue(attrList.size() == 1);
+ Assert.assertTrue(attrList.get(attrValueOver.getName()).getValue().size() == 2);
+ }
+
+ /**
+ * Testing Personal Attribute List get method. Personal Attribute list must
+ * be size 1 - Simple attribute.
+ */
+ @Test
+ public void testGetSimpleAttr() {
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.add(ATTR_VALUE);
+ Assert.assertEquals(ATTR_VALUE, attrList.get(ATTR_VALUE.getName()));
+ }
+
+ /**
+ * Testing Personal Attribute List add method. Personal Attribute list must
+ * be size 1 - Complex attribute.
+ */
+ @Test
+ public void testGetCompleAttr() {
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.add(complexAttrValue);
+ Assert.assertEquals(complexAttrValue.toString(),
+ attrList.get(complexAttrValue.getName()).toString());
+ }
+
+ /**
+ * Testing Personal Attribute List get method. Personal Attribute list must
+ * be size 2 - IsAgeOver attribute.
+ */
+ @SuppressWarnings("serial")
+ @Test
+ public void testGetIsAgeOverAttr() {
+ final PersonalAttribute attrValueUnder
+ = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
+ {
+ add("15");
+ }
+ }, STORKStatusCode.STATUS_AVAILABLE.toString());
+
+ final PersonalAttribute attrValueOver
+ = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
+ {
+ add("18");
+ }
+ }, STORKStatusCode.STATUS_AVAILABLE.toString());
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.add(attrValueUnder);
+ attrList.add(attrValueOver);
+ Assert.assertNotEquals(SIMPLE_ATTRLIST,
+ attrList.get(attrValueUnder.getName()).toString());
+ Assert.assertNotEquals(SIMPLE_ATTRLIST2,
+ attrList.get(attrValueOver.getName()).toString());
+ Assert.assertEquals(SIMPLE_ATTRLIST4,
+ attrList.get(attrValueOver.getName()).toString());
+ }
+
+ /**
+ * Testing Personal Attribute List populate method. Personal Attribute list
+ * must be size 1 - Simple attribute.
+ */
+ @Test
+ public void testPopulateSimpleAttr() {
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.populate(SIMPLE_ATTRLIST);
+ Assert.assertTrue(attrList.size() == 1);
+ }
+
+ /**
+ * Testing Personal Attribute List populate method. Personal Attribute list
+ * must be size 1 - Complex attribute.
+ */
+ @Test
+ public void testPopulateComplexAttr() {
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.populate(COMPLEX_ATTRLIST);
+ Assert.assertTrue(attrList.size() == 1);
+ }
+
+ /**
+ * Testing Personal Attribute List populate method. Personal Attribute list
+ * must be size 1 - Simple and Complex attribute.
+ */
+ @Test
+ public void testPopulateMixAttrs() {
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.populate(STR_MIX_ATTR_LIST);
+ Assert.assertTrue(attrList.size() == 2);
+ //Assert.assertTrue(attrList.get(attrValueOver.getName()).getValue().size() == 2);
+ }
+
+ /**
+ * Testing Personal Attribute List toString method using add.
+ */
+ @SuppressWarnings("serial")
+ @Test
+ public void testToStringFromAdd() {
+ final PersonalAttribute attrValueUnder
+ = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
+ {
+ add("15");
+ }
+ }, STORKStatusCode.STATUS_AVAILABLE.toString());
+
+ final PersonalAttribute attrValueOver
+ = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
+ {
+ add("18");
+ }
+ }, STORKStatusCode.STATUS_AVAILABLE.toString());
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.add(attrValueUnder);
+ attrList.add(attrValueOver);
+ Assert.assertEquals(SIMPLE_ATTRLIST4, attrList.toString());
+ }
+
+ /**
+ * Testing Personal Attribute List toString method using put.
+ *
+ */
+ @SuppressWarnings("serial")
+ @Test
+ public void testToStringFromPut() {
+ final PersonalAttribute attrValueUnder
+ = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
+ {
+ add("15");
+ }
+ }, STORKStatusCode.STATUS_AVAILABLE.toString());
+
+ final PersonalAttribute attrValueOver
+ = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
+ {
+ add("18");
+ }
+ }, STORKStatusCode.STATUS_AVAILABLE.toString());
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.put(attrValueUnder.getName(), attrValueUnder);
+ attrList.put(attrValueOver.getName(), attrValueOver);
+ Assert.assertEquals(SIMPLE_ATTRLIST4, attrList.toString());
+ }
+
+ /**
+ * Testing Personal Attribute List toString method using populate.
+ */
+ @Test
+ public void testToStringFromSimplePopulate() {
+ final String strAttrList = "isAgeOver:true";
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.populate(strAttrList);
+ Assert.assertEquals("isAgeOver:true:[]:;", attrList.toString());
+ }
+
+ /**
+ * Testing Personal Attribute List toString method using populate.
+ */
+ @Test
+ public void testToStringFromPopulate() {
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.populate(SIMPLE_ATTRLIST3);
+ Assert.assertEquals(SIMPLE_ATTRLIST4, attrList.toString());
+ }
+
+ /**
+ * Testing Personal Attribute List populate method, with invalid values.
+ */
+ @Test
+ public void testPopulateWithInvalidValuesFormat() {
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ pal.populate("name:type:values:status;");
+ Assert.assertEquals(pal, new PersonalAttributeList());
+ }
+
+ /**
+ * Testing Personal Attribute List populate method, with invalid format.
+ */
+ @Test
+ public void testPopulateWithInvalidFormat() {
+
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ pal.populate("name:type::status;");
+ Assert.assertEquals(pal, new PersonalAttributeList());
+ }
+
+ /**
+ * Testing Personal Attribute List clone method using add.
+ */
+ @SuppressWarnings("serial")
+ @Test
+ public void testCloneFromAdd() {
+ final PersonalAttribute attrValueUnder
+ = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
+ {
+ add("15");
+ }
+ }, STORKStatusCode.STATUS_AVAILABLE.toString());
+
+ final PersonalAttribute attrValueOver
+ = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
+ {
+ add("18");
+ }
+ }, STORKStatusCode.STATUS_AVAILABLE.toString());
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.add(attrValueUnder);
+ attrList.add(attrValueOver);
+ Assert.assertNotSame(attrList, attrList.clone());
+ }
+
+ /**
+ * Testing Personal Attribute List clone method using put.
+ */
+ @SuppressWarnings("serial")
+ @Test
+ public void testCloneFromPut() {
+ final PersonalAttribute attrValueUnder
+ = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
+ {
+ add("15");
+ }
+ }, STORKStatusCode.STATUS_AVAILABLE.toString());
+
+ final PersonalAttribute attrValueOver
+ = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() {
+ {
+ add("18");
+ }
+ }, STORKStatusCode.STATUS_AVAILABLE.toString());
+ final IPersonalAttributeList attrList = new PersonalAttributeList(1);
+ attrList.put(attrValueUnder.getName(), attrValueUnder);
+ attrList.put(attrValueOver.getName(), attrValueOver);
+ Assert.assertNotSame(attrList, attrList.clone());
+ }
+
+ /**
+ * Testing Personal Attribute List clone method using populate.
+ */
+ @Test
+ public void testCloneFromPopulate() {
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ pal.populate(SIMPLE_ATTRLIST3);
+ Assert.assertNotSame(pal, pal.clone());
+ }
+
+ /**
+ * Testing Personal Attribute List iterator.
+ */
+ @Test
+ public void testIterator() {
+ final String strAttrList
+ = "isAgeOver:true:[15,]:Available;isAgeOver:true:[18,]:Available;";
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ pal.populate(strAttrList);
+ final Iterator<PersonalAttribute> itAttr = pal.iterator();
+ while (itAttr.hasNext()) {
+ final PersonalAttribute attr = itAttr.next();
+ Assert.assertEquals(ISAGEOVER_CONS, attr.getName());
}
- }, STORKStatusCode.STATUS_AVAILABLE.toString());
- final PersonalAttributeList attrList = new PersonalAttributeList(1);
- attrList.put(attrValueUnder.getName(), attrValueUnder);
- attrList.put(attrValueOver.getName(), attrValueOver);
- Assert.assertNotSame(attrList, attrList.clone());
- }
-
- /**
- * Testing Personal Attribute List clone method using populate.
- */
- @Test
- public void testCloneFromPopulate() {
- final PersonalAttributeList pal = new PersonalAttributeList();
- pal.populate(SIMPLE_ATTRLIST3);
- Assert.assertNotSame(pal, pal.clone());
- }
-
- /**
- * Testing Personal Attribute List iterator.
- */
- @Test
- public void testIterator() {
- final String strAttrList =
- "isAgeOver:true:[15,]:Available;isAgeOver:true:[18,]:Available;";
- final PersonalAttributeList pal = new PersonalAttributeList();
- pal.populate(strAttrList);
- final Iterator<PersonalAttribute> itAttr = pal.iterator();
- while (itAttr.hasNext()) {
- final PersonalAttribute attr = itAttr.next();
- Assert.assertEquals(ISAGEOVER_CONS, attr.getName());
- }
- }
-
- /**
- * Testing Personal Attribute List's GetOptionalAttributes method with empty attribute list.
- */
- @Test
- public void testGetOptionalAttributesWithEmptyList() {
- final PersonalAttributeList pal = new PersonalAttributeList();
- Assert.assertTrue(pal.getOptionalAttributes().isEmpty());
- }
-
- /**
- * Testing Personal Attribute List's GetOptionalAttributes method without optional attributes.
- */
- @Test
- public void testGetOptionalAttributesWithoutOptional() {
- final String strAttrList =
- "isAgeOver:true:[15,]:Available;isAgeOver:true:[18,]:Available;";
- final PersonalAttributeList pal = new PersonalAttributeList();
- pal.populate(strAttrList);
- Assert.assertTrue(pal.getOptionalAttributes().isEmpty());
- }
-
- /**
- * Testing Personal Attribute List's GetOptionalAttributes method with one optional attribute.
- */
- @Test
- public void testGetOptionalAttributesWithOneOptional() {
- final String strAttrList =
- "age:false:[]:;isAgeOver:true:[15,]:;isAgeOver:true:[18,]:;";
- final PersonalAttributeList pal = new PersonalAttributeList();
- pal.populate(strAttrList);
- Assert.assertTrue(pal.getOptionalAttributes().size() == ONE_CONS);
- }
-
- /**
- * Testing Personal Attribute List's GetOptionalAttributes method with two optional attribute.
- */
- @Test
- public void testGetOptionalAttributesWithOnlyOptional() {
- final String strAttrList =
- "age:false:[]:;isAgeOver:false:[18,]:;";
- final PersonalAttributeList pal = new PersonalAttributeList();
- pal.populate(strAttrList);
- Assert.assertTrue(pal.getOptionalAttributes().size() == TWO_CONS);
- }
-
- /**
- * Testing Personal Attribute List's getMandatoryAttributes method with empty attribute list.
- */
- @Test
- public void testGetMandatoryAttributesWithEmptyList() {
- final PersonalAttributeList pal = new PersonalAttributeList();
- Assert.assertTrue(pal.getMandatoryAttributes().isEmpty());
- }
-
- /**
- * Testing Personal Attribute List's getMandatoryAttributes method without mandatory attributes.
- */
- @Test
- public void testGetMandatoryAttributesWithoutMandatory() {
- final String strAttrList =
- "isAgeOver:false:[15,]:Available;isAgeOver:false:[18,]:Available;";
- final PersonalAttributeList pal = new PersonalAttributeList();
- pal.populate(strAttrList);
- Assert.assertTrue(pal.getMandatoryAttributes().isEmpty());
- }
-
- /**
- * Testing Personal Attribute List's GetMandatoryAttributes method with one mandatory attribute.
- */
- @Test
- public void testGetMandatoryAttributesWithOneMandatory() {
- final String strAttrList =
- "age:true:[]:;isAgeOver:false:[15,]:;isAgeOver:false:[18,]:;";
- final PersonalAttributeList pal = new PersonalAttributeList();
- pal.populate(strAttrList);
- Assert.assertTrue(pal.getMandatoryAttributes().size() == ONE_CONS);
- }
-
- /**
- * Testing Personal Attribute List's GetMandatoryAttributes method with two mandatory attribute.
- */
- @Test
- public void testGetMandatoryAttributesWithOnlyMandatory() {
- final String strAttrList =
- "age:true:[]:;isAgeOver:true:[18,]:;";
- final PersonalAttributeList pal = new PersonalAttributeList();
- pal.populate(strAttrList);
- Assert.assertTrue(pal.getMandatoryAttributes().size() == TWO_CONS);
- }
-
- /**
- * Testing Personal Attribute List's getSimpleValueAttributes method with empty attribute list.
- */
- @Test
- public void testGetSimpleValueAttributesWithEmptyList() {
- final PersonalAttributeList pal = new PersonalAttributeList();
- Assert.assertTrue(pal.getSimpleValueAttributes().isEmpty());
- }
-
- /**
- * Testing Personal Attribute List's getSimpleValueAttributes() method without simple attributes.
- */
- @Test
- public void testGetSimpleValueAttributesWithoutSimple() {
- final PersonalAttributeList pal = new PersonalAttributeList();
- pal.populate(COMPLEX_ATTRLIST);
- Assert.assertTrue(pal.getSimpleValueAttributes().isEmpty());
- }
-
- /**
- * Testing Personal Attribute List's getSimpleValueAttributes() method with one simple attribute.
- */
- @Test
- public void testGetSimpleValueAttributesWithOneSimple() {
- final PersonalAttributeList pal = new PersonalAttributeList();
- pal.populate(STR_MIX_ATTR_LIST);
- Assert.assertTrue(pal.getSimpleValueAttributes().size() == ONE_CONS);
- }
-
- /**
- * Testing Personal Attribute List's GetMandatoryAttributes method with two simple attribute.
- */
- @Test
- public void testGetSimpleValueAttributesWithOnlySimple() {
- final PersonalAttributeList pal = new PersonalAttributeList();
- pal.populate(SIMPLE_ATTRLIST3);
- Assert.assertTrue(pal.getSimpleValueAttributes().size() == TWO_CONS);
- }
-
- /**
- * Testing Personal Attribute List's getComplexValueAttributes method with empty attribute list.
- */
- @Test
- public void testGetComplexAttributesWithEmptyList() {
- final PersonalAttributeList pal = new PersonalAttributeList();
- Assert.assertTrue(pal.getComplexAttributes().isEmpty());
- }
-
- /**
- * Testing Personal Attribute List's getComplexAttributes() method without complex attributes.
- */
- @Test
- public void testGetComplexAttributesWithoutSimple() {
- final PersonalAttributeList pal = new PersonalAttributeList();
- pal.populate(SIMPLE_ATTRLIST2);
- Assert.assertTrue(pal.getComplexAttributes().isEmpty());
- }
-
- /**
- * Testing Personal Attribute List's getComplexAttributes() method with one complex attribute.
- */
- @Test
- public void testGetComplexAttributesWithOneComplex() {
- final PersonalAttributeList pal = new PersonalAttributeList();
- pal.populate(STR_MIX_ATTR_LIST);
- Assert.assertTrue(pal.getComplexAttributes().size() == ONE_CONS);
- }
-
- /**
- * Testing Personal Attribute List's GetMandatoryAttributes method with only two Complex attribute.
- */
- @Test
- public void testGetComplexAttributesWithOnlyComplex() {
- final PersonalAttributeList pal = new PersonalAttributeList();
- pal.populate(STR_MIX_ATTR_LIST2);
- Assert.assertTrue(pal.getComplexAttributes().size() == TWO_CONS);
- }
+ }
+
+ /**
+ * Testing Personal Attribute List's GetOptionalAttributes method with empty
+ * attribute list.
+ */
+ @Test
+ public void testGetOptionalAttributesWithEmptyList() {
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ Assert.assertTrue(pal.getOptionalAttributes().isEmpty());
+ }
+
+ /**
+ * Testing Personal Attribute List's GetOptionalAttributes method without
+ * optional attributes.
+ */
+ @Test
+ public void testGetOptionalAttributesWithoutOptional() {
+ final String strAttrList
+ = "isAgeOver:true:[15,]:Available;isAgeOver:true:[18,]:Available;";
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ pal.populate(strAttrList);
+ Assert.assertTrue(pal.getOptionalAttributes().isEmpty());
+ }
+
+ /**
+ * Testing Personal Attribute List's GetOptionalAttributes method with one
+ * optional attribute.
+ */
+ @Test
+ public void testGetOptionalAttributesWithOneOptional() {
+ final String strAttrList
+ = "age:false:[]:;isAgeOver:true:[15,]:;isAgeOver:true:[18,]:;";
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ pal.populate(strAttrList);
+ Assert.assertTrue(pal.getOptionalAttributes().size() == ONE_CONS);
+ }
+
+ /**
+ * Testing Personal Attribute List's GetOptionalAttributes method with two
+ * optional attribute.
+ */
+ @Test
+ public void testGetOptionalAttributesWithOnlyOptional() {
+ final String strAttrList
+ = "age:false:[]:;isAgeOver:false:[18,]:;";
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ pal.populate(strAttrList);
+ Assert.assertTrue(pal.getOptionalAttributes().size() == TWO_CONS);
+ }
+
+ /**
+ * Testing Personal Attribute List's getMandatoryAttributes method with
+ * empty attribute list.
+ */
+ @Test
+ public void testGetMandatoryAttributesWithEmptyList() {
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ Assert.assertTrue(pal.getMandatoryAttributes().isEmpty());
+ }
+
+ /**
+ * Testing Personal Attribute List's getMandatoryAttributes method without
+ * mandatory attributes.
+ */
+ @Test
+ public void testGetMandatoryAttributesWithoutMandatory() {
+ final String strAttrList
+ = "isAgeOver:false:[15,]:Available;isAgeOver:false:[18,]:Available;";
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ pal.populate(strAttrList);
+ Assert.assertTrue(pal.getMandatoryAttributes().isEmpty());
+ }
+
+ /**
+ * Testing Personal Attribute List's GetMandatoryAttributes method with one
+ * mandatory attribute.
+ */
+ @Test
+ public void testGetMandatoryAttributesWithOneMandatory() {
+ final String strAttrList
+ = "age:true:[]:;isAgeOver:false:[15,]:;isAgeOver:false:[18,]:;";
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ pal.populate(strAttrList);
+ Assert.assertTrue(pal.getMandatoryAttributes().size() == ONE_CONS);
+ }
+
+ /**
+ * Testing Personal Attribute List's GetMandatoryAttributes method with two
+ * mandatory attribute.
+ */
+ @Test
+ public void testGetMandatoryAttributesWithOnlyMandatory() {
+ final String strAttrList
+ = "age:true:[]:;isAgeOver:true:[18,]:;";
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ pal.populate(strAttrList);
+ Assert.assertTrue(pal.getMandatoryAttributes().size() == TWO_CONS);
+ }
+
+ /**
+ * Testing Personal Attribute List's getSimpleValueAttributes method with
+ * empty attribute list.
+ */
+ @Test
+ public void testGetSimpleValueAttributesWithEmptyList() {
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ Assert.assertTrue(pal.getSimpleValueAttributes().isEmpty());
+ }
+
+ /**
+ * Testing Personal Attribute List's getSimpleValueAttributes() method
+ * without simple attributes.
+ */
+ @Test
+ public void testGetSimpleValueAttributesWithoutSimple() {
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ pal.populate(COMPLEX_ATTRLIST);
+ Assert.assertTrue(pal.getSimpleValueAttributes().isEmpty());
+ }
+
+ /**
+ * Testing Personal Attribute List's getSimpleValueAttributes() method with
+ * one simple attribute.
+ */
+ @Test
+ public void testGetSimpleValueAttributesWithOneSimple() {
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ pal.populate(STR_MIX_ATTR_LIST);
+ Assert.assertTrue(pal.getSimpleValueAttributes().size() == ONE_CONS);
+ }
+
+ /**
+ * Testing Personal Attribute List's GetMandatoryAttributes method with two
+ * simple attribute.
+ */
+ @Test
+ public void testGetSimpleValueAttributesWithOnlySimple() {
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ pal.populate(SIMPLE_ATTRLIST3);
+ Assert.assertTrue(pal.getSimpleValueAttributes().size() == ONE_CONS);
+ }
+
+ /**
+ * Testing Personal Attribute List's getComplexValueAttributes method with
+ * empty attribute list.
+ */
+ @Test
+ public void testGetComplexAttributesWithEmptyList() {
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ Assert.assertTrue(pal.getComplexAttributes().isEmpty());
+ }
+
+ /**
+ * Testing Personal Attribute List's getComplexAttributes() method without
+ * complex attributes.
+ */
+ @Test
+ public void testGetComplexAttributesWithoutSimple() {
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ pal.populate(SIMPLE_ATTRLIST2);
+ Assert.assertTrue(pal.getComplexAttributes().isEmpty());
+ }
+
+ /**
+ * Testing Personal Attribute List's getComplexAttributes() method with one
+ * complex attribute.
+ */
+ @Test
+ public void testGetComplexAttributesWithOneComplex() {
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ pal.populate(STR_MIX_ATTR_LIST);
+ Assert.assertTrue(pal.getComplexAttributes().size() == ONE_CONS);
+ }
+
+ /**
+ * Testing Personal Attribute List's GetMandatoryAttributes method with only
+ * two Complex attribute.
+ */
+ @Test
+ public void testGetComplexAttributesWithOnlyComplex() {
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ pal.populate(STR_MIX_ATTR_LIST2);
+ Assert.assertTrue(pal.getComplexAttributes().size() == TWO_CONS);
+ }
}