diff options
Diffstat (limited to 'eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/GivenNameAttrBuilderTest.java')
-rw-r--r-- | eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/GivenNameAttrBuilderTest.java | 110 |
1 files changed, 57 insertions, 53 deletions
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/GivenNameAttrBuilderTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/GivenNameAttrBuilderTest.java index dd1dfa5e..62324491 100644 --- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/GivenNameAttrBuilderTest.java +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/GivenNameAttrBuilderTest.java @@ -16,57 +16,61 @@ import at.gv.egiz.eaaf.core.impl.idp.builder.attributes.GivenNameAttributeBuilde @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("/SpringTest-context_eaaf_core.xml") -public class GivenNameAttrBuilderTest extends AbstractAttributeBuilderTest{ - - private final IAttributeBuilder attrBuilde = new GivenNameAttributeBuilder(); - - @Test - public void performTest_ok() { - try { - final IAuthData authData = buildAuthData(); - final String value = attrBuilde.build(spConfig, authData, g); - Assert.assertEquals("GivenName does NOT match", authData.getGivenName(), value); - - } catch (final Exception e) { - Assert.assertTrue("Attr. builder has an exception", e == null); - - } - - } - - @Test - public void performTest_null() { - try { - final AuthenticationData authData = (AuthenticationData) buildAuthData(); - authData.setGivenName(null); - - attrBuilde.build(spConfig, authData, g); - Assert.assertTrue("Attr. Builder provide no 'UnavailableAttributeException'", false); - - } catch (final Exception e) { - Assert.assertTrue("Attr. builder provide wrong exception", e instanceof UnavailableAttributeException); - Assert.assertEquals("Attr. name in exception does NOT match", - PVPAttributeDefinitions.GIVEN_NAME_NAME, ((UnavailableAttributeException) e).getAttributeName()); - - } - - } - - @Test - public void performTest_emtpty() { - try { - final AuthenticationData authData = (AuthenticationData) buildAuthData(); - authData.setGivenName(StringUtils.EMPTY); - - attrBuilde.build(spConfig, authData, g); - Assert.assertTrue("Attr. Builder provide no 'UnavailableAttributeException'", false); - - } catch (final Exception e) { - Assert.assertTrue("Attr. builder provide wrong exception", e instanceof UnavailableAttributeException); - Assert.assertEquals("Attr. name in exception does NOT match", - PVPAttributeDefinitions.GIVEN_NAME_NAME, ((UnavailableAttributeException) e).getAttributeName()); - - } - - } +public class GivenNameAttrBuilderTest extends AbstractAttributeBuilderTest { + + private final IAttributeBuilder attrBuilde = new GivenNameAttributeBuilder(); + + @Test + public void performTest_ok() { + try { + final IAuthData authData = buildAuthData(); + final String value = attrBuilde.build(spConfig, authData, gen); + Assert.assertEquals("GivenName does NOT match", authData.getGivenName(), value); + + } catch (final Exception e) { + Assert.assertTrue("Attr. builder has an exception", e == null); + + } + + } + + @Test + public void performTest_null() { + try { + final AuthenticationData authData = (AuthenticationData) buildAuthData(); + authData.setGivenName(null); + + attrBuilde.build(spConfig, authData, gen); + Assert.assertTrue("Attr. Builder provide no 'UnavailableAttributeException'", false); + + } catch (final Exception e) { + Assert.assertTrue("Attr. builder provide wrong exception", + e instanceof UnavailableAttributeException); + Assert.assertEquals("Attr. name in exception does NOT match", + PVPAttributeDefinitions.GIVEN_NAME_NAME, + ((UnavailableAttributeException) e).getAttributeName()); + + } + + } + + @Test + public void performTest_emtpty() { + try { + final AuthenticationData authData = (AuthenticationData) buildAuthData(); + authData.setGivenName(StringUtils.EMPTY); + + attrBuilde.build(spConfig, authData, gen); + Assert.assertTrue("Attr. Builder provide no 'UnavailableAttributeException'", false); + + } catch (final Exception e) { + Assert.assertTrue("Attr. builder provide wrong exception", + e instanceof UnavailableAttributeException); + Assert.assertEquals("Attr. name in exception does NOT match", + PVPAttributeDefinitions.GIVEN_NAME_NAME, + ((UnavailableAttributeException) e).getAttributeName()); + + } + + } } |