AccountStateServiceImpl implements AccountStateService { @Override public void initialMintingToKnownAddress(Accounts accounts) { logger.traceEntry("params: {}", accounts); AccountState accountState = null; try { AccountAddress accountAddress = AppServiceProvider.getShardingService().getAddressForMinting(accounts.getShard()); accountState = getOrCreateAccountState(accountAddress, accounts); accountState.setBalance(Util.VALUE_MINTING); setAccountState(accountAddress, accountState, accounts); accounts.getAccountsPersistenceUnit().commit(); logger.trace("Done initial minting!"); } catch (Exception ex) { logger.catching(ex); } logger.traceExit(); }  @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 public void testInitialMintingToKnownAddress() throws IOException, ClassNotFoundException { accountStateService.initialMintingToKnownAddress(accounts); AccountState state = accountStateService.getAccountState(AppServiceProvider.getShardingService().getAddressForMinting(accounts.getShard()), accounts); Assert.assertNotNull(state); Assert.assertTrue(state.getBalance().compareTo(Util.VALUE_MINTING) == 0); }