mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-22 14:42:37 +01:00
changed fiat comparison in tests, added comments
This commit is contained in:
parent
77431b3d94
commit
5415878356
4 changed files with 30 additions and 31 deletions
|
@ -70,12 +70,14 @@ public class BitSquareModule extends AbstractModule {
|
|||
//bind(String.class).annotatedWith(Names.named("networkType")).toInstance(WalletFacade.MAIN_NET);
|
||||
// how to use reg test see description in the readme file
|
||||
bind(String.class).annotatedWith(Names.named("networkType")).toInstance(WalletFacade.REG_TEST_NET);
|
||||
//test net not working yet: http://sourceforge.net/p/bitcoin/mailman/message/32349208/
|
||||
//bind(String.class).annotatedWith(Names.named("networkType")).toInstance(WalletFacade.TEST_NET);
|
||||
bind(NetworkParameters.class).toProvider(NetworkParametersProvider.class).asEagerSingleton();
|
||||
|
||||
// we will probably later disc storage instead of memory storage for TomP2P
|
||||
// bind(Boolean.class).annotatedWith(Names.named("useDiskStorage")).toInstance(new Boolean(true));
|
||||
bind(Boolean.class).annotatedWith(Names.named("useDiskStorage")).toInstance(new Boolean(false));
|
||||
|
||||
// might be better in a config file?
|
||||
bind(SeedNodeAddress.StaticSeedNodeAddresses.class).annotatedWith(
|
||||
Names.named("defaultSeedNode")).toInstance(SeedNodeAddress.StaticSeedNodeAddresses.LOCALHOST);
|
||||
// bind(SeedNodeAddress.StaticSeedNodeAddresses.class).annotatedWith(Names.named("defaultSeedNode"))
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
/**
|
||||
* Guice support for fxml controllers
|
||||
* Support caching. Speed up switches between UI screens.
|
||||
* Support caching to speed up switches between UI screens.
|
||||
*/
|
||||
public class GuiceFXMLLoader {
|
||||
private static final Logger log = LoggerFactory.getLogger(GuiceFXMLLoader.class);
|
||||
|
|
|
@ -24,11 +24,8 @@ import java.util.Objects;
|
|||
public class Country implements Serializable {
|
||||
private static final long serialVersionUID = -5930294199097793187L;
|
||||
|
||||
|
||||
private final String code;
|
||||
|
||||
private final String name;
|
||||
|
||||
private final Region region;
|
||||
|
||||
public Country(String code, String name, Region region) {
|
||||
|
@ -37,10 +34,24 @@ public class Country implements Serializable {
|
|||
this.region = region;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Region getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof Country)) {
|
||||
return false;
|
||||
|
@ -53,22 +64,6 @@ public class Country implements Serializable {
|
|||
return code.equals(other.getCode());
|
||||
}
|
||||
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public Region getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "code='" + code + '\'' +
|
||||
|
|
|
@ -33,6 +33,8 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
//TODO: Fiat to Fiat comparision fails even value is the same -> investigate equals method in fiat and report bug if
|
||||
// there is any
|
||||
public class CreateOfferPresenterTest {
|
||||
private static final Logger log = LoggerFactory.getLogger(CreateOfferPresenterTest.class);
|
||||
|
||||
|
@ -50,37 +52,37 @@ public class CreateOfferPresenterTest {
|
|||
presenter.amount.set("1");
|
||||
assertEquals("500.00", presenter.volume.get());
|
||||
assertEquals(Coin.COIN, model.amountAsCoin);
|
||||
assertEquals(Fiat.valueOf("EUR", 500 * 10000), model.priceAsFiat);
|
||||
assertEquals(Fiat.valueOf("EUR", 500 * 10000), model.tradeVolumeAsFiat);
|
||||
assertEquals(Fiat.valueOf("EUR", 500 * 10000).getValue(), model.priceAsFiat.getValue());
|
||||
assertEquals(Fiat.valueOf("EUR", 500 * 10000).getValue(), model.tradeVolumeAsFiat.getValue());
|
||||
assertEquals(Coin.parseCoin("0.1011"), model.totalToPayAsCoin.get());
|
||||
|
||||
presenter.price.set("500");
|
||||
presenter.volume.set("500");
|
||||
assertEquals("1.00", presenter.amount.get());
|
||||
assertEquals(Coin.COIN, model.amountAsCoin);
|
||||
assertEquals(Fiat.valueOf("EUR", 500 * 10000), model.priceAsFiat);
|
||||
assertEquals(Fiat.valueOf("EUR", 500 * 10000), model.tradeVolumeAsFiat);
|
||||
assertEquals(Fiat.valueOf("EUR", 500 * 10000).getValue(), model.priceAsFiat.getValue());
|
||||
assertEquals(Fiat.valueOf("EUR", 500 * 10000).getValue(), model.tradeVolumeAsFiat.getValue());
|
||||
|
||||
presenter.price.set("300");
|
||||
presenter.volume.set("1000");
|
||||
assertEquals("3.3333", presenter.amount.get());
|
||||
assertEquals(Coin.parseCoin("3.3333"), model.amountAsCoin);
|
||||
assertEquals(Fiat.valueOf("EUR", 300 * 10000), model.priceAsFiat);
|
||||
assertEquals(Fiat.valueOf("EUR", 9999900), model.tradeVolumeAsFiat);
|
||||
assertEquals(Fiat.valueOf("EUR", 300 * 10000).getValue(), model.priceAsFiat.getValue());
|
||||
assertEquals(Fiat.valueOf("EUR", 9999900).getValue(), model.tradeVolumeAsFiat.getValue());
|
||||
|
||||
presenter.price.set("300");
|
||||
presenter.amount.set("3.3333");
|
||||
assertEquals("999.99", presenter.volume.get());
|
||||
assertEquals(Coin.parseCoin("3.3333"), model.amountAsCoin);
|
||||
assertEquals(Fiat.valueOf("EUR", 300 * 10000), model.priceAsFiat);
|
||||
assertEquals(Fiat.valueOf("EUR", 9999900), model.tradeVolumeAsFiat);
|
||||
assertEquals(Fiat.valueOf("EUR", 300 * 10000).getValue(), model.priceAsFiat.getValue());
|
||||
assertEquals(Fiat.valueOf("EUR", 9999900).getValue(), model.tradeVolumeAsFiat.getValue());
|
||||
|
||||
presenter.price.set("300");
|
||||
presenter.amount.set("3.33333333");
|
||||
assertEquals("999.99", presenter.volume.get());
|
||||
assertEquals(Coin.parseCoin("3.3333"), model.amountAsCoin);
|
||||
assertEquals(Fiat.valueOf("EUR", 300 * 10000), model.priceAsFiat);
|
||||
assertEquals(Fiat.valueOf("EUR", 9999900), model.tradeVolumeAsFiat);
|
||||
assertEquals(Fiat.valueOf("EUR", 300 * 10000).getValue(), model.priceAsFiat.getValue());
|
||||
assertEquals(Fiat.valueOf("EUR", 9999900).getValue(), model.tradeVolumeAsFiat.getValue());
|
||||
|
||||
|
||||
model.collateralAsLong.set(100);
|
||||
|
|
Loading…
Add table
Reference in a new issue