### Question:
SignCertificateRequestHandler implements Runnable { @Override public void run() { try { Security.addProvider(new BouncyCastleProvider()); ECParameterSpec ecSpec = ECNamedCurveTable.getParameterSpec("prime256v1"); KeyPairGenerator g = KeyPairGenerator.getInstance("ECDSA", "BC"); g.initialize(ecSpec, new SecureRandom()); KeyPair keyPair = g.generateKeyPair(); String csr = generatePKCS10(keyPair.getPublic(), keyPair.getPrivate()); stationStore.setStationPublicKey(keyPair.getPublic()); stationStore.setStationPrivateKey(keyPair.getPrivate()); stationMessageSender.sendSignCertificateRequest(csr); } catch (Exception e) { log.debug("Error while creating the CSR", e); } } SignCertificateRequestHandler(StationStore stationStore, StationMessageSender stationMessageSender); @Override void run();  }### Answer:
@Test void verifyCSRCorrectlyCreated() throws Exception { requestHandler.run(); verify(stationStoreMock).setStationPublicKey(any()); verify(stationStoreMock).setStationPrivateKey(any()); verify(stationMessageSenderMock).sendSignCertificateRequest(messageCaptor.capture()); String csr = messageCaptor.getValue(); PKCS10CertificationRequest certificationRequest = getCSR(csr); assertThat(certificationRequest).isNotNull(); assertThat(certificationRequest.getSubject().getRDNs()[0].getFirst().getValue().toASN1Primitive().toString()).isEqualTo(StationHardwareData.SERIAL_NUMBER); }