TestActorRef<BankActor> bank = TestActorRef.apply(new Props(
BankActor.class), _system);
bank.tell(new TransferMsg(Float.valueOf("1500")));
AccountBalance balance = (AccountBalance) Await.result(
ask(bank, new AccountBalance("XYZ"), 5000),
Duration.create("5 second"));
Assert.assertEquals(Float.parseFloat("3500"), balance.getBalance(),
Float.parseFloat("0"));
balance = (AccountBalance) Await.result(
ask(bank, new AccountBalance("ABC"), 5000),
Duration.create("5 second"));
Assert.assertEquals(Float.parseFloat("2500"), balance.getBalance(),
Float.parseFloat("0"));
bank.tell(new TransferMsg(Float.valueOf("4000")));
Thread.sleep(2000);
balance = (AccountBalance) Await.result(
ask(bank, new AccountBalance("XYZ"), 5000),
Duration.create("5 second"));
Assert.assertEquals(Float.parseFloat("3500"), balance.getBalance(),
Float.parseFloat("0"));
balance = (AccountBalance) Await.result(
ask(bank, new AccountBalance("ABC"), 5000),
Duration.create("5 second"));
Assert.assertEquals(Float.parseFloat("2500"), balance.getBalance(),
Float.parseFloat("0"));
}