### Question:
X509Locator implements Locator { @Override public UnverifiedKeyBindingType locate(LocateRequestType request) { List<UseKeyWithType> keyIDs = parse(request); X509Certificate cert; try { cert = findCertificate(keyIDs); if (cert == null) { return null; } UnverifiedKeyBindingType result = new UnverifiedKeyBindingType(); result.setKeyInfo(X509Utils.getKeyInfo(cert)); return result; } catch (CertificateEncodingException e) { throw new XKMSCertificateException("Cannot encode certificate: " + e.getMessage(), e); } catch (CertificateException e1) { throw new XKMSCertificateException(e1.getMessage(), e1); } } X509Locator(CertificateRepo certRepo); @Override UnverifiedKeyBindingType locate(LocateRequestType request); X509Certificate findCertificate(List<UseKeyWithType> ids);  }### Answer:
@Test public void locate() throws CertificateException { CertificateRepo certRepo = EasyMock.createMock(CertificateRepo.class); EasyMock.expect(certRepo.findBySubjectDn(EasyMock.eq("alice"))).andReturn(getAliceCert()); EasyMock.replay(certRepo); X509Locator locator = new X509Locator(certRepo); LocateRequestType request = prepareLocateXKMSRequest(); UnverifiedKeyBindingType result = locator.locate(request); Assert.assertNotNull(result.getKeyInfo()); }