### Question:
IntegrationServiceImpl implements IntegrationService, Runnable { protected static byte[] buildPkcs8Key(String privateKey) { if (privateKey.contains("--BEGIN PRIVATE KEY--")) { return DECODER.decode(privateKey.replaceAll("-----\\w+ PRIVATE KEY-----", "")); } if (!privateKey.contains("--BEGIN RSA PRIVATE KEY--")) { LOGGER.error("Invalid cert format: {}", privateKey); return StringUtils.EMPTY.getBytes(); } final byte[] innerKey = DECODER.decode(privateKey.replaceAll("-----\\w+ RSA PRIVATE KEY-----", "")); final byte[] result = new byte[innerKey.length + 26]; System.arraycopy(DECODER.decode("MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKY="), 0, result, 0, 26); System.arraycopy(BigInteger.valueOf(result.length - 4).toByteArray(), 0, result, 2, 2); System.arraycopy(BigInteger.valueOf(innerKey.length).toByteArray(), 0, result, 24, 2); System.arraycopy(innerKey, 0, result, 26, innerKey.length); return result; }  @Override void run(); @Override String getAccessToken(); @Override String getApiKey(); @Override int getTimeoutinMilliSeconds();  }### Answer:
@Test public void testGenerateKeywithInvalidKey() { byte[] result = IntegrationServiceImpl.buildPkcs8Key("invalid"); assertEquals(new String(result), ""); }
@Test public void testGenerateKeywithValidKey() { byte[] result = IntegrationServiceImpl.buildPkcs8Key(config.privateKey()); assertNotEquals(new String(result), ""); assertNotNull(result); }