question: public void testSetPublicKey4 ( ) throws Exception { Identity i = new IdentityStub ( "testSetPublicKey4" ) ; PublicKeyStub pk1 = new PublicKeyStub ( "kkk" , "Identity.testSetPublicKey4" , null ) ; CertificateStub c1 = new CertificateStub ( "fff" , null , null , pk1 ) ; CertificateStub c2 = new CertificateStub ( "zzz" , null , null , pk1 ) ; i . addCertificate ( c1 ) ; i . addCertificate ( c2 ) ; assertEquals ( 2 , i . certificates ( ) . length ) ; assertSame ( pk1 , i . getPublicKey ( ) ) ; PublicKeyStub pk2 = new PublicKeyStub ( "zzz" , "Identity.testSetPublicKey4" , null ) ; i . setPublicKey ( pk2 ) ; assertSame ( pk2 , i . getPublicKey ( ) ) ; assertEquals ( 0 , i . certificates ( ) . length ) ; }
target:  verify Identity.setPublicKey()  removes old key and all identity's certificates