@Test public void singlevalueAttribute() { ShibbolethAttribute singleAttrValid = new ShibbolethAttribute(ATTR_NAME, SINGLEVALUE_VALID); String[] values = singleAttrValid.getValues(); assertNotNull("contains one value", values); assertEquals(1, values.length); assertEquals(LEARNER, values[0]); assertEquals(LEARNER, singleAttrValid.getFirstValue()); }
@Test public void multivalueAttributeWithEmails() { ShibbolethAttribute multivalueAttrValid = new ShibbolethAttribute(ATTR_NAME, MULTIVALUE_VALID); String[] values = multivalueAttrValid.getValues(); assertNotNull("contains three values", values); assertEquals(3, values.length); assertEquals(LEARNER, values[0]); assertEquals(AUTHOR, values[1]); assertEquals(ADMIN, values[2]); assertEquals(LEARNER, multivalueAttrValid.getFirstValue()); }
@Test public void multivalueAttributeWith8859String() { try { String rawRequestValue = new String(MULTIVALUE_VALID.getBytes("ISO-8859-1")); ShibbolethAttribute fromRequestShibbAttribute = ShibbolethAttribute.createFromUserRequestValue(ATTR_NAME, rawRequestValue); String[] values = fromRequestShibbAttribute.getValues(); assertNotNull("contains three values", values); assertEquals(3, values.length); assertEquals(LEARNER, values[0]); assertEquals(AUTHOR, values[1]); assertEquals(ADMIN, values[2]); assertEquals(LEARNER, fromRequestShibbAttribute.getFirstValue()); } catch (UnsupportedEncodingException e) { fail(e.toString()); } }