use of org.apache.harmony.security.tests.java.security.Identity2Test.IdentitySubclass in project robovm by robovm.
the class IdentityScope2Test method test_getIdentityLjava_security_Principal.
/**
* java.security.IdentityScope#getIdentity(java.security.Principal)
*/
public void test_getIdentityLjava_security_Principal() throws Exception {
Identity id = new IdentitySubclass("principal name");
id.setPublicKey(getPubKey());
IdentityScopeSubclass sub = new IdentityScopeSubclass("test", new IdentityScopeSubclass());
try {
sub.getIdentity((java.security.Principal) null);
fail("Test 1: NullPointerException expected.");
} catch (NullPointerException expected) {
}
sub.addIdentity(id);
Identity returnedId = sub.getIdentity(id);
assertEquals("Test 2: Returned Identity not the same as the added one;", id, returnedId);
Identity id2 = new IdentitySubclass("Another identity");
id2.setPublicKey(getPubKey());
assertNull("Test 3: Null value expected.", sub.getIdentity(id2));
try {
sub.getIdentity((java.security.Principal) null);
fail("Test 4: NullPointerException expected.");
} catch (NullPointerException expected) {
}
}
use of org.apache.harmony.security.tests.java.security.Identity2Test.IdentitySubclass in project robovm by robovm.
the class IdentityScope2Test method test_size.
/**
* java.security.IdentityScope#size()
*/
public void test_size() throws Exception {
IdentityScopeSubclass sub = new IdentityScopeSubclass("test", new IdentityScopeSubclass());
Identity id = new IdentitySubclass();
id.setPublicKey(getPubKey());
sub.addIdentity(id);
assertEquals("Wrong size", 1, sub.size());
}
use of org.apache.harmony.security.tests.java.security.Identity2Test.IdentitySubclass in project robovm by robovm.
the class IdentityScope2Test method test_getIdentityLjava_lang_String.
/**
* java.security.IdentityScope#getIdentity(java.lang.String)
*/
public void test_getIdentityLjava_lang_String() throws Exception {
IdentityScopeSubclass sub = new IdentityScopeSubclass("test", new IdentityScopeSubclass());
Identity id = new IdentitySubclass("test");
id.setPublicKey(getPubKey());
sub.addIdentity(id);
Identity returnedId = sub.getIdentity("test");
assertEquals("Returned Identity not the same as the added one", id, returnedId);
}
Aggregations