@Test(expected = RuntimeException.class) @PrepareForTest(HashUtils.class) public void algorithmNotFound() throws NoSuchAlgorithmException { mockStatic(MessageDigest.class); NoSuchAlgorithmException cause = new NoSuchAlgorithmException(); doThrow(cause).when(MessageDigest.class); MessageDigest.getInstance(anyString()); try { HashUtils.sha256(""); } catch (RuntimeException e) { assertEquals(cause, e.getCause()); throw e; } }
@NonNull public static String sha256(@NonNull String data) { return sha256(data, "UTF-8"); }
HashUtils { @NonNull public static String sha256(@NonNull String data) { return sha256(data, "UTF-8"); } }
HashUtils { @NonNull public static String sha256(@NonNull String data) { return sha256(data, "UTF-8"); } @VisibleForTesting  HashUtils(); }
HashUtils { @NonNull public static String sha256(@NonNull String data) { return sha256(data, "UTF-8"); } @VisibleForTesting  HashUtils(); @NonNull static String sha256(@NonNull String data); }
HashUtils { @NonNull public static String sha256(@NonNull String data) { return sha256(data, "UTF-8"); } @VisibleForTesting  HashUtils(); @NonNull static String sha256(@NonNull String data);  }