AccountStateServiceImpl implements AccountStateService { @Override public synchronized AccountState getOrCreateAccountState(AccountAddress address, Accounts accounts) throws IOException, ClassNotFoundException { logger.traceEntry("params: {} {}", address, accounts); Util.check(address != null, "address!=null"); Util.check(accounts != null, "accounts!=null"); AccountState state = getAccountState(address, accounts); if (state != null) { logger.trace("state not null"); return logger.traceExit(state); } logger.trace("Create account state..."); setAccountState(address, new AccountState(address), accounts); return logger.traceExit(getAccountState(address, accounts)); }  @Override synchronized AccountState getOrCreateAccountState(AccountAddress address, Accounts accounts); @Override synchronized AccountState getAccountState(AccountAddress address, Accounts accounts); @Override synchronized void rollbackAccountStates(Accounts accounts); @Override synchronized void commitAccountStates(Accounts accounts); @Override synchronized void setAccountState(AccountAddress address, AccountState state, Accounts accounts); @Override byte[] convertAccountStateToRLP(AccountState accountState); @Override AccountState convertToAccountStateFromRLP(byte[] data); @Override void initialMintingToKnownAddress(Accounts accounts); @Override Fun.Tuple2<Block, Transaction> generateGenesisBlock(String initialAddress, BigInteger initialValue, AppState state, AppContext context);  }
@Test(expected = IllegalArgumentException.class) public void testGetOrCreateaAccountStateWithNullAddressShouldThrowException() throws IOException, ClassNotFoundException { accountStateService.getOrCreateAccountState(null, accounts); }
@Test(expected = IllegalArgumentException.class) public void testGetOrCreateaAccountStateWithNullAccountsShouldThrowException() throws IOException, ClassNotFoundException { accountStateService.getOrCreateAccountState(address, null); }
@Test public void testGetOrCreateaAccountStateWithNonExistingAddress() throws IOException, ClassNotFoundException { AccountState state = accountStateService.getOrCreateAccountState(address, accounts); Assert.assertNotNull(state); }