@Test
public void testGenerateGenesisBlock() throws IOException, ClassNotFoundException {

    AccountsContext accountsContext = new AccountsContext();
    AppState appState = new AppState();
    AppContext appContext = new AppContext();
    appContext.setPort(4000);
    appContext.setMasterPeerPort(4000);
    appContext.setNodeName("node");
    PrivateKey privateKey = new PrivateKey();
    PublicKey publicKey = new PublicKey(new PrivateKey());
    appContext.setPrivateKey(privateKey);
    Shard shard = AppServiceProvider.getShardingService().getShard(publicKey.getValue());
    accountsContext.setShard(shard);
    appState.setShard(shard);
    appState.setConnection( AppServiceProvider.getP2PConnectionService().createConnection(appContext));
    accounts = new Accounts(accountsContext, new AccountsPersistenceUnit<>(""));
    String initialAddress = Util.byteArrayToHexString(publicKey.getValue());
    accountStateService.generateGenesisBlock(initialAddress, BigInteger.TEN, appState, appContext);
    AccountState state = accountStateService.getAccountState(AppServiceProvider.getShardingService().getAddressForMinting(accounts.getShard()), accounts);
    Assert.assertNotNull(state);
    Assert.assertTrue(state.getBalance().compareTo(Util.VALUE_MINTING) == 0);
    Assert.assertTrue(state.getBalance().compareTo(Util.VALUE_MINTING) == 0);
}