PasswordEncoderImpl implements PasswordEncoder { @Override public String encode(@NonNull String rawPassword) { String encodedPassword = this.updatableBCrypt.hash(rawPassword, this.keyStore.decryptString(this.customPreference.getSalt(), Constants.ALIAS_SALT)); return keyStore.encryptString(encodedPassword, Constants.ALIAS_PASSWORD_KEY); } PasswordEncoderImpl(CustomPreference customPreference, KeyStore keyStore, UpdatableBCrypt updatableBCrypt); void init(); @Override String encode(@NonNull String rawPassword); @Override boolean matches(@NonNull String rawPassword, @NonNull String encodedPassword);  }
@Test public void encodeTestSuccess() { String result = passwordEncoder.encode(TESTABLE_PASSWORD); assertNotNull(result); assertEquals(ENCODED_PASSWORD, result); }