### Question:
AccountBaseService { public Result getPrivateKey(String address, String password) { if (!AddressTool.validAddress(address)) { return Result.getFailed(AccountErrorCode.ADDRESS_ERROR); } Account account = accountService.getAccount(address).getData(); if (null == account) { return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST); } if (account.isEncrypted()) { try { byte[] priKeyBytes = priKeyBytes = account.getPriKey(password); return Result.getSuccess().setData(Hex.encode(priKeyBytes)); } catch (NulsException e) { return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG); } } return Result.getFailed(AccountErrorCode.ACCOUNT_UNENCRYPTED); }  Result setRemark(String address, String remark); Result getPrivateKey(String address, String password); Result getAllPrivateKey(String password); Result getAllPrivateKey(); Result setPassword(String address, String password); Result changePassword(String address, String oldPassword, String newPassword);  }### Answer:
@Test public void getPrivateKeyTest() { List<Account> accounts = this.accountService.createAccount(1, "nuls123456").getData(); Account account = accounts.get(0); Result result = accountBaseService.getPrivateKey(account.getAddress().toString(), "nuls123456"); assertTrue(result.isSuccess()); try { account.unlock("nuls123456"); } catch (NulsException e) { e.printStackTrace(); } assertArrayEquals(Hex.decode((String)result.getData()), account.getPriKey()); List<Account> accounts2 = this.accountService.createAccount(1, "").getData(); Account account2 = accounts2.get(0); Result result2 = accountBaseService.getPrivateKey(account2.getAddress().toString(), ""); assertTrue(result2.isSuccess()); assertArrayEquals(Hex.decode((String)result2.getData()), account2.getPriKey()); }