use of java.security.Identity in project robovm by robovm.
the class IdentityScope2Test method test_removeIdentityLjava_security_Identity.
/**
* java.security.IdentityScope#removeIdentity(java.security.Identity)
*/
public void test_removeIdentityLjava_security_Identity() throws Exception {
IdentityScopeSubclass sub = new IdentityScopeSubclass("test", new IdentityScopeSubclass());
Identity id = new IdentitySubclass();
id.setPublicKey(getPubKey());
sub.addIdentity(id);
sub.removeIdentity(id);
try {
sub.removeIdentity(id);
fail("KeyManagementException should have been thrown");
} catch (KeyManagementException expected) {
}
}
use of java.security.Identity in project robovm by robovm.
the class IdentityScope2Test method test_toString.
/**
* java.security.IdentityScope#toString()
*/
public void test_toString() throws Exception {
IdentityScopeSubclass sub = new IdentityScopeSubclass("test", new IdentityScopeSubclass());
Identity id = new IdentitySubclass();
id.setPublicKey(getPubKey());
sub.addIdentity(id);
assertNotNull("toString returned a null", sub.toString());
assertTrue("Not a valid String ", sub.toString().length() > 0);
}
use of java.security.Identity in project robovm by robovm.
the class IdentityScope2Test method test_identities.
/**
* java.security.IdentityScope#identities()
*/
public void test_identities() throws Exception {
IdentityScopeSubclass sub = new IdentityScopeSubclass("test", new IdentityScopeSubclass());
Identity id = new IdentitySubclass();
id.setPublicKey(getPubKey());
sub.addIdentity(id);
Enumeration<Identity> en = sub.identities();
assertEquals("Wrong object contained in identities", en.nextElement(), id);
assertFalse("Contains too many elements", en.hasMoreElements());
}
use of java.security.Identity in project robovm by robovm.
the class IdentityScope2Test method test_getIdentityLjava_security_PublicKey.
/**
* java.security.IdentityScope#getIdentity(java.security.PublicKey)
*/
public void test_getIdentityLjava_security_PublicKey() throws Exception {
IdentityScopeSubclass sub = new IdentityScopeSubclass("test", new IdentityScopeSubclass());
Identity id = new IdentitySubclass();
id.setPublicKey(getPubKey());
sub.addIdentity(id);
Identity returnedId = sub.getIdentity(getPubKey());
assertEquals("Test 1: Returned Identity not the same as the added one;", id, returnedId);
assertNull("Test 2: Null value expected.", sub.getIdentity((PublicKey) null));
PublicKey anotherKey = KeyPairGenerator.getInstance("DSA").genKeyPair().getPublic();
assertNull("Test 3: Null value expected.", sub.getIdentity(anotherKey));
}
use of java.security.Identity in project robovm by robovm.
the class IdentityTest method testGetName.
public void testGetName() {
Identity i = new IdentityStub("testGetName");
assertEquals("testGetName", i.getName());
}
Aggregations