@Test public void should_read_certificate() throws Exception { byte[] bytes = new byte[] {1, 2}; IdentityModel identityModel = new IdentityModel(); identityModel.setContextId("contextId"); given(identityService.findIdentity(bytes)).willReturn(of(identityModel)); IdentityModel result = identityResource.findIdentityByCertificate(bytes); assertThat(result).isEqualTo(identityModel); }
@GET @Consumes(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.APPLICATION_JSON) public IdentityModel findIdentityByCertificate(byte[] certificate) throws InvalidParseOperationException, CertificateException { return identityService.findIdentity(certificate).orElseThrow(NotFoundException::new); }
IdentityResource { @GET @Consumes(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.APPLICATION_JSON) public IdentityModel findIdentityByCertificate(byte[] certificate) throws InvalidParseOperationException, CertificateException { return identityService.findIdentity(certificate).orElseThrow(NotFoundException::new); } }
IdentityResource { @GET @Consumes(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.APPLICATION_JSON) public IdentityModel findIdentityByCertificate(byte[] certificate) throws InvalidParseOperationException, CertificateException { return identityService.findIdentity(certificate).orElseThrow(NotFoundException::new); } IdentityResource(IdentityService identityService); }
IdentityResource { @GET @Consumes(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.APPLICATION_JSON) public IdentityModel findIdentityByCertificate(byte[] certificate) throws InvalidParseOperationException, CertificateException { return identityService.findIdentity(certificate).orElseThrow(NotFoundException::new); } IdentityResource(IdentityService identityService); @GET @Consumes(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.APPLICATION_JSON) IdentityModel findIdentityByCertificate(byte[] certificate); @GET @Path("context/{contextId}") @Produces(MediaType.APPLICATION_JSON) Response contextIsUsed(@PathParam("contextId") String contextId); }
IdentityResource { @GET @Consumes(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.APPLICATION_JSON) public IdentityModel findIdentityByCertificate(byte[] certificate) throws InvalidParseOperationException, CertificateException { return identityService.findIdentity(certificate).orElseThrow(NotFoundException::new); } IdentityResource(IdentityService identityService); @GET @Consumes(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.APPLICATION_JSON) IdentityModel findIdentityByCertificate(byte[] certificate); @GET @Path("context/{contextId}") @Produces(MediaType.APPLICATION_JSON) Response contextIsUsed(@PathParam("contextId") String contextId);  }