* verify certificates() returns a copy of all certificates for this identity
*/
public void testCertificates() throws Exception {
Identity i = new IdentityStub("iii");
PublicKeyStub pk1 = new PublicKeyStub("kkk", "fff", null);
CertificateStub c1 = new CertificateStub("fff", null, null, pk1);
CertificateStub c2 = new CertificateStub("zzz", null, null, pk1);
i.addCertificate(c1);
i.addCertificate(c2);
Certificate[] s = i.certificates();
assertEquals(2, s.length);
assertTrue(c1.equals(s[0]) || c2.equals(s[0]));
assertTrue(c1.equals(s[1]) || c2.equals(s[1]));
s[0] = null;
s[1] = null;
// check that the copy was modified
s = i.certificates();
assertEquals(2, s.length);
assertTrue(c1.equals(s[0]) || c2.equals(s[0]));
assertTrue(c1.equals(s[1]) || c2.equals(s[1]));
}