### Question:
HashUtils { public static String sha512(String message) { return hash(message, MessageDigestAlgorithm.SHA512); } private  HashUtils(); static String sha1(String message); static String sha256(String message); static String sha512(String message); static String md5(String message); static MessageDigest getDigest(MessageDigestAlgorithm algorithm); static boolean isValidBcryptHash(String hash); static String hash(String message, MessageDigest algorithm);  }### Answer:
@Test public void shouldHashSha512() { String[] correctHashes = { "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e", "b109f3bbbc244eb82441917ed06d618b9008dd09b3befd1b5e07394c706a8bb980b1d7785e5976ec049b46df5f1326af5a2ea6d103fd07c95385ffab0cacbc86", "ae9942149995a8171391625b36da134d5e288c721650d7c8d2d464fb49a49f3f551e4916ab1e097d9dd1201b01d69b1dccdefa3d2524a66092fb61b3df6e7e71", "8c4f3df78db191142d819a72c16058b9e1ea41ae9b1649e1184eb89e30344c51c9c71039c483cf2f1b76b51480d8459d7eb3cfbaa24b07f2041d1551af4ead75" }; List<String> result = new ArrayList<>(); for (String password : GIVEN_PASSWORDS) { result.add(HashUtils.sha512(password)); } assertThat(result, contains(correctHashes)); }