RadixIdentities { public static RadixIdentity createNewEncryptedIdentity(Writer writer, String password) throws IOException, GeneralSecurityException, PrivateKeyException, PublicKeyException { String encryptedKey = PrivateKeyEncrypter.createEncryptedPrivateKey(password); writer.write(encryptedKey); writer.flush(); return readEncryptedIdentity(new StringReader(encryptedKey), password); } private  RadixIdentities(); static RadixIdentity fromPrivateKeyBase64(String privateKeyBase64); static LocalRadixIdentity createNew(); static RadixIdentity loadOrCreateFile(File keyFile); static RadixIdentity loadOrCreateFile(String filePath); static RadixIdentity loadOrCreateEncryptedFile(File keyFile, String password); static RadixIdentity loadOrCreateEncryptedFile(String filePath, String password); static RadixIdentity createNewEncryptedIdentity(Writer writer, String password); static RadixIdentity readEncryptedIdentity(Reader reader, String password);  }
@Test public void newEncryptedIdentityWriterTest() throws Exception { Writer writer = mock(Writer.class); RadixIdentities.createNewEncryptedIdentity(writer, "Password"); verify(writer, times(1)).flush(); }