com.google.bitcoin.utils
Class TestWithWallet
java.lang.Object
com.google.bitcoin.utils.TestWithWallet
public class TestWithWallet
- extends Object
A utility class that you can derive from in your unit tests. TestWithWallet sets up a wallet with a key,
an in memory block store and a block chain object. It also provides helper methods for filling the wallet
with money in whatever ways you wish. Note that for simplicity with amounts, this class sets the default
fee per kilobyte to zero in setUp and back to normal in tearDown. If you are wanting to test your behaviour
with fees (a good idea!) make sure you set the Wallet.SendRequest#DEFAULT_FEE_PER_KB value to
Transaction.REFERENCE_DEFAULT_MIN_TX_FEE before doing so.
|
Method Summary |
protected Transaction |
sendMoneyToWallet(BigInteger value,
AbstractBlockChain.NewBlockType type)
|
protected Transaction |
sendMoneyToWallet(Transaction tx,
AbstractBlockChain.NewBlockType type)
|
protected Transaction |
sendMoneyToWallet(Wallet wallet,
BigInteger value,
Address toAddress,
AbstractBlockChain.NewBlockType type)
|
protected Transaction |
sendMoneyToWallet(Wallet wallet,
BigInteger value,
ECKey toPubKey,
AbstractBlockChain.NewBlockType type)
|
protected Transaction |
sendMoneyToWallet(Wallet wallet,
Transaction tx,
AbstractBlockChain.NewBlockType type)
|
void |
setUp()
|
void |
tearDown()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
params
protected static final NetworkParameters params
myKey
protected ECKey myKey
myAddress
protected Address myAddress
wallet
protected Wallet wallet
chain
protected BlockChain chain
blockStore
protected BlockStore blockStore
TestWithWallet
public TestWithWallet()
setUp
public void setUp()
throws Exception
- Throws:
Exception
tearDown
public void tearDown()
throws Exception
- Throws:
Exception
sendMoneyToWallet
@Nullable
protected Transaction sendMoneyToWallet(Wallet wallet,
Transaction tx,
AbstractBlockChain.NewBlockType type)
throws IOException,
VerificationException
- Throws:
IOException
VerificationException
sendMoneyToWallet
@Nullable
protected Transaction sendMoneyToWallet(Transaction tx,
AbstractBlockChain.NewBlockType type)
throws IOException,
VerificationException
- Throws:
IOException
VerificationException
sendMoneyToWallet
@Nullable
protected Transaction sendMoneyToWallet(Wallet wallet,
BigInteger value,
Address toAddress,
AbstractBlockChain.NewBlockType type)
throws IOException,
VerificationException
- Throws:
IOException
VerificationException
sendMoneyToWallet
@Nullable
protected Transaction sendMoneyToWallet(Wallet wallet,
BigInteger value,
ECKey toPubKey,
AbstractBlockChain.NewBlockType type)
throws IOException,
VerificationException
- Throws:
IOException
VerificationException
sendMoneyToWallet
@Nullable
protected Transaction sendMoneyToWallet(BigInteger value,
AbstractBlockChain.NewBlockType type)
throws IOException,
VerificationException
- Throws:
IOException
VerificationException
Copyright © 2014. All rights reserved.