question: public void testAddCertificate1 ( ) throws Exception { Identity i = new IdentityStub ( "iii" ) ; PublicKeyStub pk1 = new PublicKeyStub ( "kkk" , "fff" , new byte [ ] { 1 , 2 , 3 , 4 , 5 } ) ; i . setPublicKey ( pk1 ) ; CertificateStub c1 = new CertificateStub ( "fff" , null , null , pk1 ) ; i . addCertificate ( c1 ) ; assertSame ( c1 , i . certificates ( ) [ 0 ] ) ; try { i . addCertificate ( new CertificateStub ( "ccc" , null , null , new PublicKeyStub ( "k2" , "fff" , new byte [ ] { 6 , 7 , 8 , 9 , 0 } ) ) ) ; fail ( "KeyManagementException should be thrown" ) ; } catch ( KeyManagementException ok ) { } }
target:  verify addCertificate(Certificate certificate) adds a certificate for this identity. If the identity has a public key, the public key in the certificate must be the same