CryptoService { public String passwordHash(String password) { try { MessageDigest m = MessageDigest.getInstance("SHA-256"); byte[] out = m.digest((password+salt).getBytes()); return new String(Base64.getEncoder().encode(out)); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } }  String passwordHash(String password); String generateRandomPassword();  }
@Test public void encrypt_password(){ assertThat(cryptoService.passwordHash("test")).isNotEmpty(); }