Upgraded to Gradle 7.1.
This commit is contained in:
parent
2ef72938f2
commit
b99169c501
11 changed files with 40 additions and 38 deletions
|
@ -172,13 +172,13 @@ open class CryptoPrice(val base: String, val currency: String, val amount: BigDe
|
|||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
|
||||
other as CryptoPrice
|
||||
|
||||
|
||||
if (base != other.base) return false
|
||||
if (currency != other.currency) return false
|
||||
if (amount != other.amount) return false
|
||||
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -208,10 +208,10 @@ open class CryptoPrice(val base: String, val currency: String, val amount: BigDe
|
|||
val json = JSONStringer()
|
||||
if (key.isNotBlank()) json.`object`().key(key)
|
||||
json.`object`()
|
||||
.key("base").value(base)
|
||||
.key("currency").value(currency)
|
||||
.key("amount").value(amount.toString())
|
||||
.endObject()
|
||||
.key("base").value(base)
|
||||
.key("currency").value(currency)
|
||||
.key("amount").value(amount.toString())
|
||||
.endObject()
|
||||
if (key.isNotBlank()) json.endObject()
|
||||
return json.toString()
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ class CryptoPriceTest {
|
|||
val data = jsonData.format(d)
|
||||
with(data.toPrice()) {
|
||||
assertEquals(data, toJson(), "toJson($d)")
|
||||
assertEquals(data.replace("data","price$i"), toJson("price$i"), "toJson(price$i)")
|
||||
assertEquals(data.replace("data", "price$i"), toJson("price$i"), "toJson(price$i)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ class CryptoPriceTest {
|
|||
|
||||
assertEquals(price, price.toString().toPrice(""), "toPrice('')")
|
||||
assertEquals(price, price.toJson("test").toPrice("test"), "toPrice(test)")
|
||||
|
||||
|
||||
assertFailsWith(
|
||||
message = "amount conversion did not fail",
|
||||
exceptionClass = CryptoException::class,
|
||||
|
@ -165,7 +165,7 @@ class CryptoPriceTest {
|
|||
|
||||
@Test
|
||||
fun testToString() {
|
||||
val json = jsonPrice.format("1234.5")
|
||||
val json = jsonPrice.format("1234.5")
|
||||
val price = json.toPrice("")
|
||||
assertEquals(json, price.toString(), "toString()")
|
||||
assertEquals(price.toString(), price.toJson(""), "toString() = toJson('')")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue