diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/test/kotlin/MoneyTests.kt b/src/test/kotlin/MoneyTests.kt index 899c416..87e292f 100644 --- a/src/test/kotlin/MoneyTests.kt +++ b/src/test/kotlin/MoneyTests.kt @@ -9,13 +9,16 @@ import org.junit.Test class MoneyTests { @Test - fun test() { + fun money_operator_test() { val money = Money(10.0) val money2 = Money(20.0) money *= money println((money + money2) * money2) - Assert.assertEquals(10, 10) + Assert.assertEquals(100.0, money.value, 0.0) + } + @Test + fun exchange_2usd_to_khr_test() { val properties = MoneyConfig .MoneyConfigProperties .MoneyConfigPropertiesBuilder() @@ -27,11 +30,13 @@ class MoneyTests { .setProperties(properties) .parse("USD:1,KHR:4000") + Assert.assertTrue(MoneyConfig.isValid()) + println(MoneyConfig.getConfig()) - val moneyUsd = Money(10.0) + val moneyUsd = Money(2.0) val moneyKhr = MoneyExchangeUtils.exchange(moneyUsd, "KHR") - Assert.assertEquals(40000.0, moneyKhr.getMoneyValue(), 0.0) + Assert.assertEquals(8000.0, moneyKhr.getMoneyValue(), 0.0) } } \ No newline at end of file