CrlResource { @ApiOperation(notes = "Deletes a Certificate from the Revocation List", value = "unrevoke") @DELETE @Produces(MediaType.APPLICATION_JSON) public void unrevoke(@QueryParam("serial") String[] serialIds) throws CRLException, IOException { String filePath = getCrlFilePath(); File crlFile = new File(filePath); try { List<BigInteger> serials = new LinkedList<>(); for (CertificateSerial serial : certificateSerialCurator.listBySerialIds(serialIds)) { serials.add(serial.getSerial()); } if (serials.size() > 0) { this.crlFileUtil.updateCRLFile(crlFile, null, serials); } } catch (IOException e) { throw new IseException(e.getMessage(), e); } } @Inject  CrlResource(Configuration config, CrlFileUtil crlFileUtil, PKIUtility pkiUtility,
        CertificateSerialCurator certificateSerialCurator); @ApiOperation(notes = "Retrieves the Certificate Revocation List", value = "getCurrentCrl", response = String.class) @GET @Produces(MediaType.TEXT_PLAIN) Response getCurrentCrl(@Context Principal principal); @ApiOperation(notes = "Deletes a Certificate from the Revocation List", value = "unrevoke") @DELETE @Produces(MediaType.APPLICATION_JSON) void unrevoke(@QueryParam("serial") String[] serialIds);  }
@Test @SuppressWarnings("unchecked") public void testUnrevokeWithArguments() throws Exception { String[] input = new String[] { "123", "456", "789" }; CandlepinQuery cqmock = mock(CandlepinQuery.class); List<CertificateSerial> serials = new LinkedList<>(); serials.add(new CertificateSerial(123L)); serials.add(new CertificateSerial(456L)); serials.add(new CertificateSerial(789L)); when(cqmock.iterator()).thenReturn(serials.iterator()); when(this.certSerialCurator.listBySerialIds(eq(input))).thenReturn(cqmock); this.resource.unrevoke(input); verify(crlFileUtil).updateCRLFile(any(File.class), nullable(Collection.class), anyCollection()); }
@Test @SuppressWarnings("unchecked") public void testUnrevokeWithNoArguments() throws Exception { String[] input = new String[] { }; CandlepinQuery cqmock = mock(CandlepinQuery.class); List<CertificateSerial> serials = new LinkedList<>(); when(cqmock.iterator()).thenReturn(serials.iterator()); when(this.certSerialCurator.listBySerialIds(eq(input))).thenReturn(cqmock); this.resource.unrevoke(input); verifyNoMoreInteractions(crlFileUtil); }