### Question:
X509CertificateWikiStore extends AbstractX509WikiStore implements CertificateStore { @Override public CertificateProvider getCertificateProvider(StoreReference store) throws CertificateStoreException { return new X509CertificateProvider(resolveStore(store), getCertificateFactory(), getEncoder(), getQueryManager(), getSerializer()); }  @Override void store(StoreReference store, CertifiedPublicKey certificate); @Override CertificateProvider getCertificateProvider(StoreReference store); @Override Collection<CertifiedPublicKey> getAllCertificates(StoreReference store); static final String CERTIFICATECLASS_SPACE; static final String CERTIFICATECLASS_NAME; static final String CERTIFICATECLASS_FULLNAME; static final LocalDocumentReference CERTIFICATECLASS; static final String CERTIFICATECLASS_PROP_ISSUER; static final String CERTIFICATECLASS_PROP_SERIAL; static final String CERTIFICATECLASS_PROP_SUBJECT; static final String CERTIFICATECLASS_PROP_KEYID; static final String CERTIFICATECLASS_PROP_CERTIFICATE; }### Answer:
@Test public void testRetrievingCertificateUsingKeyIdFromDocument() throws Exception { CertifiedPublicKey certificate = mockSingleCertQuery(); assertThat(this.store.getCertificateProvider(DOC_STORE_REF).getCertificate(SUBJECT_KEYID), equalTo(certificate)); verify(this.query).bindValue(BIND_KEYID, ENCODED_SUBJECTKEYID); verify(this.query, times(3)).bindValue(BIND_STORE, FULLNAME); }
@Test public void testRetrievingCertificateUsingKeyIdFromSpace() throws Exception { CertifiedPublicKey certificate = mockSingleCertQuery(); assertThat(this.store.getCertificateProvider(SPACE_STORE_REF).getCertificate(SUBJECT_KEYID), equalTo(certificate)); verify(this.query).bindValue(BIND_KEYID, ENCODED_SUBJECTKEYID); verify(this.query, times(3)).bindValue(BIND_STORE, SPACE); }
@Test public void testRetrievingCertificateUsingIssueAndSerialFromDocument() throws Exception { CertifiedPublicKey certificate = mockSingleCertQuery(); assertThat(store.getCertificateProvider(DOC_STORE_REF).getCertificate(new DistinguishedName(ISSUER), SERIAL), equalTo(certificate)); verify(query).bindValue(BIND_ISSUER, ISSUER); verify(query).bindValue(BIND_SERIAL, SERIAL.toString()); verify(query, times(3)).bindValue(BIND_STORE, FULLNAME); }
@Test public void testRetrievingCertificateUsingIssueAndSerialFromSpace() throws Exception { CertifiedPublicKey certificate = mockSingleCertQuery(); assertThat(store.getCertificateProvider(SPACE_STORE_REF).getCertificate(new DistinguishedName(ISSUER), SERIAL), equalTo(certificate)); verify(query).bindValue(BIND_ISSUER, ISSUER); verify(query).bindValue(BIND_SERIAL, SERIAL.toString()); verify(query, times(3)).bindValue(BIND_STORE, SPACE); }
@Test public void testRetrievingCertificatesUsingSubjectFromDocument() throws Exception { CertifiedPublicKey[] certs = mockMultiCertsQuery(); assertThat(this.store.getCertificateProvider(DOC_STORE_REF).getCertificate(new DistinguishedName(SUBJECT)), contains(certs)); verify(this.query).bindValue(BIND_SUBJECT, SUBJECT); verify(this.query, times(3)).bindValue(BIND_STORE, FULLNAME); }
@Test public void testRetrievingCertificatesUsingSubjectFromSpace() throws Exception { CertifiedPublicKey[] certs = mockMultiCertsQuery(); assertThat(this.store.getCertificateProvider(SPACE_STORE_REF).getCertificate(new DistinguishedName(SUBJECT)), contains(certs)); verify(this.query).bindValue(BIND_SUBJECT, SUBJECT); verify(this.query, times(3)).bindValue(BIND_STORE, SPACE); }