Fixed and updated for advanced parse with json and add provider for exchange rate for money config

This commit is contained in:
2021-02-08 14:50:31 +07:00
parent faf80ba967
commit 36599b5fb5
3 changed files with 47 additions and 11 deletions

View File

@@ -12,16 +12,15 @@ class MoneyTests {
// .setDeliSplit(',')
// .build()
val properties = buildMoneyConfigProperties {
setDeliEqual(':')
setDeliSplit(',')
}
applyMoneyConfig {
setProperties(properties)
setProperties(buildMoneyConfigProperties {
setDeliEqual(':')
setDeliSplit(',')
})
// parse("USD:1,KHR:4000")
appendRate("usd", 1.0)
appendRate("khr", 4000.0)
// appendRate("usd", 1.0)
// appendRate("khr", 4000.0)
fromJson(MyBatchRates.getJsonRates())
}
// Is valid for money config?
@@ -33,4 +32,12 @@ class MoneyTests {
// Is correct exchange?
Assert.assertEquals(8000.0, moneyKhr.getMoneyValue(), 0.0)
}
object MyBatchRates {
fun getJsonRates(): String {
return """
{"USD": 1.0,"KHR": 4000.0}
""".trimIndent()
}
}
}