mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-13 10:45:51 +00:00
WalletTest: Remove paranoid test preconditions.
This commit is contained in:
parent
a3db2229c1
commit
98bee183b6
@ -80,8 +80,7 @@ public class WalletTest extends TestWithWallet {
|
|||||||
|
|
||||||
private SecureRandom secureRandom = new SecureRandom();
|
private SecureRandom secureRandom = new SecureRandom();
|
||||||
|
|
||||||
private final ECKey OTHER_KEY = new ECKey();
|
private final Address OTHER_ADDRESS = new ECKey().toAddress(PARAMS);
|
||||||
private final Address OTHER_ADDRESS = OTHER_KEY.toAddress(PARAMS);
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@Override
|
@Override
|
||||||
@ -2272,9 +2271,6 @@ public class WalletTest extends TestWithWallet {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void feeSolverAndCoinSelectionTest_dustySendRequested() throws Exception {
|
public void feeSolverAndCoinSelectionTest_dustySendRequested() throws Exception {
|
||||||
// Make sure TestWithWallet isnt doing anything crazy.
|
|
||||||
assertEquals(0, wallet.getTransactions(true).size());
|
|
||||||
|
|
||||||
// Generate a few outputs to us that are far too small to spend reasonably
|
// Generate a few outputs to us that are far too small to spend reasonably
|
||||||
StoredBlock block = new StoredBlock(makeSolvedTestBlock(blockStore, OTHER_ADDRESS), BigInteger.ONE, 1);
|
StoredBlock block = new StoredBlock(makeSolvedTestBlock(blockStore, OTHER_ADDRESS), BigInteger.ONE, 1);
|
||||||
Transaction tx1 = createFakeTx(PARAMS, SATOSHI, myAddress);
|
Transaction tx1 = createFakeTx(PARAMS, SATOSHI, myAddress);
|
||||||
@ -2700,8 +2696,6 @@ public class WalletTest extends TestWithWallet {
|
|||||||
@Test
|
@Test
|
||||||
public void basicCategoryStepTest() throws Exception {
|
public void basicCategoryStepTest() throws Exception {
|
||||||
// Creates spends that step through the possible fee solver categories
|
// Creates spends that step through the possible fee solver categories
|
||||||
// Make sure TestWithWallet isnt doing anything crazy.
|
|
||||||
assertEquals(0, wallet.getTransactions(true).size());
|
|
||||||
|
|
||||||
// Generate a ton of small outputs
|
// Generate a ton of small outputs
|
||||||
StoredBlock block = new StoredBlock(makeSolvedTestBlock(blockStore, OTHER_ADDRESS), BigInteger.ONE, 1);
|
StoredBlock block = new StoredBlock(makeSolvedTestBlock(blockStore, OTHER_ADDRESS), BigInteger.ONE, 1);
|
||||||
@ -2785,9 +2779,6 @@ public class WalletTest extends TestWithWallet {
|
|||||||
public void testCategory2WithChange() throws Exception {
|
public void testCategory2WithChange() throws Exception {
|
||||||
// Specifically target case 2 with significant change
|
// Specifically target case 2 with significant change
|
||||||
|
|
||||||
// Make sure TestWithWallet isnt doing anything crazy.
|
|
||||||
assertEquals(0, wallet.getTransactions(true).size());
|
|
||||||
|
|
||||||
// Generate a ton of small outputs
|
// Generate a ton of small outputs
|
||||||
StoredBlock block = new StoredBlock(makeSolvedTestBlock(blockStore, OTHER_ADDRESS), BigInteger.ONE, 1);
|
StoredBlock block = new StoredBlock(makeSolvedTestBlock(blockStore, OTHER_ADDRESS), BigInteger.ONE, 1);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -2861,9 +2852,6 @@ public class WalletTest extends TestWithWallet {
|
|||||||
public void feePerKbCategoryJumpTest() throws Exception {
|
public void feePerKbCategoryJumpTest() throws Exception {
|
||||||
// Simple test of boundary condition on fee per kb in category fee solver
|
// Simple test of boundary condition on fee per kb in category fee solver
|
||||||
|
|
||||||
// Make sure TestWithWallet isnt doing anything crazy.
|
|
||||||
assertEquals(0, wallet.getTransactions(true).size());
|
|
||||||
|
|
||||||
// Generate a ton of small outputs
|
// Generate a ton of small outputs
|
||||||
StoredBlock block = new StoredBlock(makeSolvedTestBlock(blockStore, OTHER_ADDRESS), BigInteger.ONE, 1);
|
StoredBlock block = new StoredBlock(makeSolvedTestBlock(blockStore, OTHER_ADDRESS), BigInteger.ONE, 1);
|
||||||
Transaction tx = createFakeTx(PARAMS, COIN, myAddress);
|
Transaction tx = createFakeTx(PARAMS, COIN, myAddress);
|
||||||
@ -2908,8 +2896,6 @@ public class WalletTest extends TestWithWallet {
|
|||||||
@Test
|
@Test
|
||||||
public void testCompleteTxWithExistingInputs() throws Exception {
|
public void testCompleteTxWithExistingInputs() throws Exception {
|
||||||
// Tests calling completeTx with a SendRequest that already has a few inputs in it
|
// Tests calling completeTx with a SendRequest that already has a few inputs in it
|
||||||
// Make sure TestWithWallet isnt doing anything crazy.
|
|
||||||
assertEquals(0, wallet.getTransactions(true).size());
|
|
||||||
|
|
||||||
// Generate a few outputs to us
|
// Generate a few outputs to us
|
||||||
StoredBlock block = new StoredBlock(makeSolvedTestBlock(blockStore, OTHER_ADDRESS), BigInteger.ONE, 1);
|
StoredBlock block = new StoredBlock(makeSolvedTestBlock(blockStore, OTHER_ADDRESS), BigInteger.ONE, 1);
|
||||||
|
@ -30,12 +30,10 @@ import static org.bitcoinj.testing.FakeTxBuilder.createFakeTx;
|
|||||||
// TODO: This needs to be somewhat rewritten - the "sendMoneyToWallet" methods aren't sending via the block chain object
|
// TODO: This needs to be somewhat rewritten - the "sendMoneyToWallet" methods aren't sending via the block chain object
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A utility class that you can derive from in your unit tests. TestWithWallet sets up a wallet with a key,
|
* A utility class that you can derive from in your unit tests. TestWithWallet sets up an empty wallet,
|
||||||
* an in memory block store and a block chain object. It also provides helper methods for filling the wallet
|
* 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
|
* 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
|
* fee per kilobyte to zero in setUp.
|
||||||
* with fees (a good idea!) make sure you set the {@link Wallet.SendRequest#DEFAULT_FEE_PER_KB} value to
|
|
||||||
* {@link Transaction#REFERENCE_DEFAULT_MIN_TX_FEE} before doing so.
|
|
||||||
*/
|
*/
|
||||||
public class TestWithWallet {
|
public class TestWithWallet {
|
||||||
protected static final NetworkParameters PARAMS = UnitTestParams.get();
|
protected static final NetworkParameters PARAMS = UnitTestParams.get();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user