confidence fixed

This commit is contained in:
Manfred Karrer 2014-06-26 16:03:02 +02:00
parent 3d6c2a8c62
commit 0545148f74
32 changed files with 1157 additions and 529 deletions

View file

@ -0,0 +1,18 @@
package io.bitsquare;
import io.bitsquare.btc.BtcValidatorTest;
import io.bitsquare.gui.util.BitSquareConverterTest;
import io.bitsquare.gui.util.BitSquareValidatorTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
BtcValidatorTest.class,
BitSquareConverterTest.class,
BitSquareValidatorTest.class
})
public class BitSquareTestSuite
{
}

View file

@ -0,0 +1,34 @@
package io.bitsquare.btc;
import com.google.bitcoin.core.Transaction;
import org.junit.Test;
import java.math.BigInteger;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
public class BtcValidatorTest
{
@Test
public void testIsMinSpendableAmount()
{
BigInteger amount = null;
assertFalse("tx unfunded, pending", BtcValidator.isMinSpendableAmount(amount));
amount = BigInteger.ZERO;
assertFalse("tx unfunded, pending", BtcValidator.isMinSpendableAmount(amount));
amount = FeePolicy.TX_FEE;
assertFalse("tx unfunded, pending", BtcValidator.isMinSpendableAmount(amount));
amount = Transaction.MIN_NONDUST_OUTPUT;
assertFalse("tx unfunded, pending", BtcValidator.isMinSpendableAmount(amount));
amount = FeePolicy.TX_FEE.add(Transaction.MIN_NONDUST_OUTPUT);
assertFalse("tx unfunded, pending", BtcValidator.isMinSpendableAmount(amount));
amount = FeePolicy.TX_FEE.add(Transaction.MIN_NONDUST_OUTPUT).add(BigInteger.ONE);
assertTrue("tx unfunded, pending", BtcValidator.isMinSpendableAmount(amount));
}
}

View file

@ -1,57 +0,0 @@
package io.bitsquare.btc;
import com.google.inject.Guice;
import com.google.inject.Injector;
import io.bitsquare.di.BitSquareModule;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class WalletFacadeTest
{
private WalletFacade walletFacade;
@Before
public void setUp()
{
final Injector injector = Guice.createInjector(new BitSquareModule());
walletFacade = injector.getInstance(WalletFacade.class);
walletFacade.initWallet();
//TODO
/*
java.lang.IllegalStateException: Toolkit not initialized
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:276)
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:271)
at javafx.application.Platform.runLater(Platform.java:78)
at io.bitsquare.btc.WalletFacade$$Lambda$1/833474933.execute(Unknown Source)
at com.google.bitcoin.core.Wallet.queueOnKeysAdded(Wallet.java:3301)
at com.google.bitcoin.core.Wallet.addKeys(Wallet.java:2024)
at com.google.bitcoin.core.Wallet.addKey(Wallet.java:1996)
at io.bitsquare.btc.WalletFacade.getNewAddressInfo(WalletFacade.java:383)
*/
}
@After
public void tearDown()
{
//walletFacade.shutDown();
}
@Test
public void testStringToDouble()
{
// AddressEntry addressEntry = walletFacade.getUnusedTradeAddressInfo();
// assertFalse("no tx", walletFacade.isUnusedTradeAddressBalanceAboveCreationFee());
/* Transaction tx = new Transaction(walletFacade.getWallet().getNetworkParameters());
WalletTransaction walletTransaction = new WalletTransaction(WalletTransaction.Pool.PENDING, tx);
walletFacade.getWallet().addWalletTransaction(walletTransaction);
assertFalse("tx unfunded, pending", walletFacade.isUnusedTradeAddressBalanceAboveCreationFee()); */
}
}