Accounts implements Serializable, PersistenceUnitContainer { public Set<AccountAddress> getAddresses() { return (Collections.synchronizedSet(addresses)); } Accounts(AccountsContext context, AccountsPersistenceUnit<AccountAddress, AccountState> unit); Shard getShard(); AccountsPersistenceUnit<AccountAddress, AccountState> getAccountsPersistenceUnit(); Set<AccountAddress> getAddresses(); void flush(); @Override void stopPersistenceUnit();  }
@Test public void testGetAddresses() throws IOException { AccountsPersistenceUnit<AccountAddress, AccountState> unit = new AccountsPersistenceUnit<>(""); AccountsContext accountsContext = new AccountsContext(); PublicKey publicKeyMinting = AppServiceProvider.getShardingService().getPublicKeyForMinting(new Shard(0)); accountsContext.setShard(AppServiceProvider.getShardingService().getShard(publicKeyMinting.getValue())); Accounts accounts = new Accounts(accountsContext, unit); Assert.assertTrue(accounts.getAddresses()!=null ); Assert.assertEquals(1, accounts.getAddresses().size()); }