From 3fada6cef21c9b16467177d866df778203b51b4d Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 5 Dec 2019 09:52:48 +0100 Subject: some code code-style modifications active code-quality checks! --- .../eaaf/core/impl/idp/auth/IdentityLinkTest.java | 158 +++++++++++---------- 1 file changed, 80 insertions(+), 78 deletions(-) (limited to 'eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/IdentityLinkTest.java') diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/IdentityLinkTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/IdentityLinkTest.java index db97f4ca..16c2079a 100644 --- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/IdentityLinkTest.java +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/IdentityLinkTest.java @@ -20,82 +20,84 @@ import at.gv.egiz.eaaf.core.impl.idp.auth.data.SimpleIdentityLinkAssertionParser @RunWith(BlockJUnit4ClassRunner.class) public class IdentityLinkTest { - - private IdentityLink idl = null; - - /** - * jUnit test set-up. - * @throws EaafParserException In case of an error - * @throws UnsupportedEncodingException In case of an unsupported encoding - */ - @Before - public void testInit() throws EaafParserException, UnsupportedEncodingException { - idl = (IdentityLink) new SimpleIdentityLinkAssertionParser( - new ByteArrayInputStream(Base64Utils.decode(AuthenticationDataBuilderTest.DUMMY_IDL_2.getBytes("UTF-8")))).parseIdentityLink(); - - } - - @Test - public void checkElement() { - Assert.assertNotNull("DateOfBirth", idl.getDateOfBirth()); - Assert.assertNotNull("FamilyName", idl.getFamilyName()); - Assert.assertNotNull("GivenNamae", idl.getGivenName()); - Assert.assertNotNull("baseIdType", idl.getIdentificationType()); - Assert.assertNotNull("baseid", idl.getIdentificationValue()); - Assert.assertNotNull("IssuerInstant", idl.getIssueInstant()); - Assert.assertNotNull("name", idl.getName()); - Assert.assertNotNull("prPerson", idl.getPrPerson()); - Assert.assertNotNull("Assertion element", idl.getSamlAssertion()); - Assert.assertNotNull("Assertion serialized", idl.getSerializedSamlAssertion()); - Assert.assertNotNull("Transform ref", idl.getDsigReferenceTransforms()); - Assert.assertEquals("Transform Size not match", 1, idl.getDsigReferenceTransforms().length); - - } - - @Test - public void checkPubKeys() { - PublicKey[] publicKey = new RSAPublicKey[2]; - publicKey[0] = generatePubKey(); - publicKey[1] = generatePubKey(); - - idl.setPublicKey(publicKey ); - - Assert.assertNotNull("PubKey", idl.getPublicKey()); - Assert.assertEquals("PubKeys not match", publicKey.length, idl.getPublicKey().length); - - } - - private PublicKey generatePubKey() { - return new RSAPublicKey() { - private static final long serialVersionUID = 1L; - - @Override - public BigInteger getModulus() { - return new BigInteger(RandomStringUtils.randomNumeric(10)); - } - - @Override - public String getFormat() { - // TODO Auto-generated method stub - return null; - } - - @Override - public byte[] getEncoded() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getAlgorithm() { - // TODO Auto-generated method stub - return null; - } - - @Override - public BigInteger getPublicExponent() { - return new BigInteger(RandomStringUtils.randomNumeric(2)); - } - }; - } + + private IdentityLink idl = null; + + /** + * jUnit test set-up. + * + * @throws EaafParserException In case of an error + * @throws UnsupportedEncodingException In case of an unsupported encoding + */ + @Before + public void testInit() throws EaafParserException, UnsupportedEncodingException { + idl = (IdentityLink) new SimpleIdentityLinkAssertionParser( + new ByteArrayInputStream(Base64Utils.decode(AuthenticationDataBuilderTest.DUMMY_IDL_2.getBytes( + "UTF-8")))).parseIdentityLink(); + + } + + @Test + public void checkElement() { + Assert.assertNotNull("DateOfBirth", idl.getDateOfBirth()); + Assert.assertNotNull("FamilyName", idl.getFamilyName()); + Assert.assertNotNull("GivenNamae", idl.getGivenName()); + Assert.assertNotNull("baseIdType", idl.getIdentificationType()); + Assert.assertNotNull("baseid", idl.getIdentificationValue()); + Assert.assertNotNull("IssuerInstant", idl.getIssueInstant()); + Assert.assertNotNull("name", idl.getName()); + Assert.assertNotNull("prPerson", idl.getPrPerson()); + Assert.assertNotNull("Assertion element", idl.getSamlAssertion()); + Assert.assertNotNull("Assertion serialized", idl.getSerializedSamlAssertion()); + Assert.assertNotNull("Transform ref", idl.getDsigReferenceTransforms()); + Assert.assertEquals("Transform Size not match", 1, idl.getDsigReferenceTransforms().length); + + } + + @Test + public void checkPubKeys() { + final PublicKey[] publicKey = new RSAPublicKey[2]; + publicKey[0] = generatePubKey(); + publicKey[1] = generatePubKey(); + + idl.setPublicKey(publicKey); + + Assert.assertNotNull("PubKey", idl.getPublicKey()); + Assert.assertEquals("PubKeys not match", publicKey.length, idl.getPublicKey().length); + + } + + private PublicKey generatePubKey() { + return new RSAPublicKey() { + private static final long serialVersionUID = 1L; + + @Override + public BigInteger getModulus() { + return new BigInteger(RandomStringUtils.randomNumeric(10)); + } + + @Override + public String getFormat() { + // TODO Auto-generated method stub + return null; + } + + @Override + public byte[] getEncoded() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getAlgorithm() { + // TODO Auto-generated method stub + return null; + } + + @Override + public BigInteger getPublicExponent() { + return new BigInteger(RandomStringUtils.randomNumeric(2)); + } + }; + } } -- cgit v1.2.3