### Question:
SHA384Hashing extends AbstractHashing { @Override public String hash(byte[] data) { try { if (isEmpty(data)) { return null; } MessageDigest digest = MessageDigest.getInstance("SHA-384"); return new String(Hex.encode(digest.digest(data))); } catch (NoSuchAlgorithmException ex) { LOG.warn(null, ex); return null; } }  @Override String hash(byte[] data);  }### Answer:
@Test public void hashHelloWorld() { byte[] input = "Hello World".getBytes(); String output = hashing.hash(input); String expected = "99514329186b2f6ae4a1329e7ee6c610a729636335174ac6b740f9028396fcc803d0e93863a7c3d90f86beee782f4f3f"; assertThat(output).isEqualTo(expected); }
@Test public void hashPublicKey() throws IOException { try (InputStream inputStream = getClass().getResourceAsStream("/key/public-key.pub")) { byte[] input = IOUtils.toByteArray(inputStream); String output = hashing.hash(input); String expected = "0eea0c8acf694a8bf86e5c11873bd9aa1b4ab630d27b0ee434c885e4e0d198936ee10770f306f66d8eb618daa584972a"; assertThat(output).isEqualTo(expected); } }