### Question:
DecryptPioneerPayloads extends
    PTransform<PCollection<PubsubMessage>, Result<PCollection<PubsubMessage>, PubsubMessage>> { public static byte[] decrypt(PrivateKey key, String payload) throws JoseException { JsonWebEncryption jwe = new JsonWebEncryption(); jwe.setKey(key); jwe.setContentEncryptionKey(key.getEncoded()); jwe.setCompactSerialization(payload); return jwe.getPlaintextBytes(); } private  DecryptPioneerPayloads(ValueProvider<String> metadataLocation,
      ValueProvider<Boolean> kmsEnabled, ValueProvider<Boolean> decompressPayload); static DecryptPioneerPayloads of(ValueProvider<String> metadataLocation,
      ValueProvider<Boolean> kmsEnabled, ValueProvider<Boolean> decompressPayload); @Override Result<PCollection<PubsubMessage>, PubsubMessage> expand(
      PCollection<PubsubMessage> messages); static byte[] decrypt(PrivateKey key, String payload); static final String ENCRYPTED_DATA; static final String ENCRYPTION_KEY_ID; static final String SCHEMA_NAMESPACE; static final String SCHEMA_NAME; static final String SCHEMA_VERSION; static final String PIONEER_ID; static final String STUDY_NAME; static final String DELETION_REQUEST_SCHEMA_NAME; static final String ENROLLMENT_SCHEMA_NAME; }### Answer:
@Test public void testDecrypt() throws Exception { PrivateKey key = loadPrivateKey("pioneer/study-foo.private.json"); byte[] ciphertext = Resources .toByteArray(Resources.getResource("pioneer/study-foo.ciphertext.json")); byte[] plaintext = Resources .toByteArray(Resources.getResource("pioneer/sample.plaintext.json")); String payload = Json.readObjectNode(ciphertext).get("payload") .get(DecryptPioneerPayloads.ENCRYPTED_DATA).textValue(); byte[] decrypted = DecryptPioneerPayloads.decrypt(key, payload); byte[] decompressed = GzipUtil.maybeDecompress(decrypted); String actual = Json.readObjectNode(plaintext).toString(); String expect = Json.readObjectNode(decompressed).toString(); Assert.assertEquals(expect, actual); }