From 0a5d98d6317842a55c3ff7744dc7513f3ff14afe Mon Sep 17 00:00:00 2001 From: gazbert Date: Fri, 19 Aug 2022 12:43:26 +0100 Subject: [PATCH] #148 : Fix new test class compilation issue --- .../config/TestPairPrecisionConfigImpl.java | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/bxbot-exchanges/src/test/java/com/gazbert/bxbot/exchanges/config/TestPairPrecisionConfigImpl.java b/bxbot-exchanges/src/test/java/com/gazbert/bxbot/exchanges/config/TestPairPrecisionConfigImpl.java index a5dc589d..e78c9f76 100644 --- a/bxbot-exchanges/src/test/java/com/gazbert/bxbot/exchanges/config/TestPairPrecisionConfigImpl.java +++ b/bxbot-exchanges/src/test/java/com/gazbert/bxbot/exchanges/config/TestPairPrecisionConfigImpl.java @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2022 gazbert + * Copyright (c) 2022 maiph gazbert * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in @@ -25,6 +25,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; +import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; import org.junit.jupiter.api.BeforeEach; @@ -33,6 +34,7 @@ /** * Test the PairPrecisionConfigImpl behaves as expected. * + * @author maiph * @author gazbert */ class TestPairPrecisionConfigImpl { @@ -40,13 +42,16 @@ class TestPairPrecisionConfigImpl { private static final String BTC_USD_PAIR_ID = "BTC/USD"; private static final Integer BTC_USD_PRICE = Integer.valueOf("1000"); private static final Integer BTC_USD_VOLUME = Integer.valueOf("34234234"); + private static final BigDecimal BTC_USD_ORDER_MIN = new BigDecimal("0.01"); private static final String ETH_USD_PAIR_ID = "ETC/USD"; private static final Integer ETH_USD_PRICE = Integer.valueOf("4545345"); private static final Integer ETH_USD_VOLUME = Integer.valueOf("77777"); + private static final BigDecimal ETC_USD_ORDER_MIN = new BigDecimal("0.00123"); private Map prices; private Map volumes; + private Map minOrderSizes; @BeforeEach void setup() { @@ -57,12 +62,16 @@ void setup() { volumes = new HashMap<>(); volumes.put(BTC_USD_PAIR_ID, BTC_USD_VOLUME); volumes.put(ETH_USD_PAIR_ID, ETH_USD_VOLUME); + + minOrderSizes = new HashMap<>(); + minOrderSizes.put(BTC_USD_PAIR_ID, BTC_USD_ORDER_MIN); + minOrderSizes.put(ETH_USD_PAIR_ID, ETC_USD_ORDER_MIN); } @Test void getPricePrecision() { final PairPrecisionConfigImpl pairPrecisionConfig = - new PairPrecisionConfigImpl(prices, volumes); + new PairPrecisionConfigImpl(prices, volumes, minOrderSizes); assertEquals(BTC_USD_PRICE, pairPrecisionConfig.getPricePrecision(BTC_USD_PAIR_ID)); assertEquals(ETH_USD_PRICE, pairPrecisionConfig.getPricePrecision(ETH_USD_PAIR_ID)); } @@ -70,8 +79,16 @@ void getPricePrecision() { @Test void getVolumePrecision() { final PairPrecisionConfigImpl pairPrecisionConfig = - new PairPrecisionConfigImpl(prices, volumes); + new PairPrecisionConfigImpl(prices, volumes, minOrderSizes); assertEquals(BTC_USD_VOLUME, pairPrecisionConfig.getVolumePrecision(BTC_USD_PAIR_ID)); assertEquals(ETH_USD_VOLUME, pairPrecisionConfig.getVolumePrecision(ETH_USD_PAIR_ID)); } + + @Test + void getMinOrderSize() { + final PairPrecisionConfigImpl pairPrecisionConfig = + new PairPrecisionConfigImpl(prices, volumes, minOrderSizes); + assertEquals(BTC_USD_ORDER_MIN, pairPrecisionConfig.getMinimalOrderVolume(BTC_USD_PAIR_ID)); + assertEquals(ETC_USD_ORDER_MIN, pairPrecisionConfig.getMinimalOrderVolume(ETH_USD_PAIR_ID)); + } }