@Test public void should_create_certificate() throws Exception { InputStream stream = getClass().getResourceAsStream("/certificate.pem"); byte[] certificate = toByteArray(stream); adminPersonalCertificateResource.createIfNotPresent(certificate); verify(personalCertificateService, only()).createPersonalCertificateIfNotPresent(certificate); }
@POST @Consumes(MediaType.APPLICATION_OCTET_STREAM) public void createIfNotPresent(byte[] certificate) throws PersonalCertificateException, InvalidParseOperationException { ParametersChecker.checkParameter("Certificate cannot be null", certificate); personalCertificateService.createPersonalCertificateIfNotPresent(certificate); }
AdminPersonalCertificateResource { @POST @Consumes(MediaType.APPLICATION_OCTET_STREAM) public void createIfNotPresent(byte[] certificate) throws PersonalCertificateException, InvalidParseOperationException { ParametersChecker.checkParameter("Certificate cannot be null", certificate); personalCertificateService.createPersonalCertificateIfNotPresent(certificate); } }
AdminPersonalCertificateResource { @POST @Consumes(MediaType.APPLICATION_OCTET_STREAM) public void createIfNotPresent(byte[] certificate) throws PersonalCertificateException, InvalidParseOperationException { ParametersChecker.checkParameter("Certificate cannot be null", certificate); personalCertificateService.createPersonalCertificateIfNotPresent(certificate); } AdminPersonalCertificateResource(
        PersonalCertificateService personalCertificateService); }
AdminPersonalCertificateResource { @POST @Consumes(MediaType.APPLICATION_OCTET_STREAM) public void createIfNotPresent(byte[] certificate) throws PersonalCertificateException, InvalidParseOperationException { ParametersChecker.checkParameter("Certificate cannot be null", certificate); personalCertificateService.createPersonalCertificateIfNotPresent(certificate); } AdminPersonalCertificateResource(
        PersonalCertificateService personalCertificateService); @POST @Consumes(MediaType.APPLICATION_OCTET_STREAM) void createIfNotPresent(byte[] certificate); @DELETE @Consumes(MediaType.APPLICATION_OCTET_STREAM) void delete(byte[] certificate); }
AdminPersonalCertificateResource { @POST @Consumes(MediaType.APPLICATION_OCTET_STREAM) public void createIfNotPresent(byte[] certificate) throws PersonalCertificateException, InvalidParseOperationException { ParametersChecker.checkParameter("Certificate cannot be null", certificate); personalCertificateService.createPersonalCertificateIfNotPresent(certificate); } AdminPersonalCertificateResource(
        PersonalCertificateService personalCertificateService); @POST @Consumes(MediaType.APPLICATION_OCTET_STREAM) void createIfNotPresent(byte[] certificate); @DELETE @Consumes(MediaType.APPLICATION_OCTET_STREAM) void delete(byte[] certificate);  }