@Test
public void balances() throws Exception {

    BigInteger nanos = Utils.toNanoCoins(1, 0);
    Transaction tx1 = sendMoneyToWallet(nanos, AbstractBlockChain.NewBlockType.BEST_CHAIN);
    assertEquals(nanos, tx1.getValueSentToMe(wallet, true));
    // Send 0.10 to somebody else.
    Transaction send1 = wallet.createSend(new ECKey().toAddress(params), toNanoCoins(0, 10));
    // Reserialize.
    Transaction send2 = new Transaction(params, send1.bitcoinSerialize());
    assertEquals(nanos, send2.getValueSentFromMe(wallet));
    assertEquals(BigInteger.ZERO.subtract(toNanoCoins(0, 10)), send2.getValue(wallet));
}