Cleanup
This commit is contained in:
parent
d7e2613ae2
commit
7e555cf9ab
3 changed files with 9 additions and 6 deletions
5
.idea/codeStyles/Project.xml
generated
5
.idea/codeStyles/Project.xml
generated
|
@ -1,6 +1,11 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<JetCodeStyleSettings>
|
||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||
<value />
|
||||
</option>
|
||||
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="2147483647" />
|
||||
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="2147483647" />
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</JetCodeStyleSettings>
|
||||
<codeStyleSettings language="kotlin">
|
||||
|
|
|
@ -55,9 +55,7 @@ open class CryptoPrice(val base: String, val currency: String, val amount: Doubl
|
|||
val json = JSONObject(this)
|
||||
if (json.has("data")) {
|
||||
with(json.getJSONObject("data")) {
|
||||
return CryptoPrice(
|
||||
getString("base"), getString("currency"), getString("amount").toDouble()
|
||||
)
|
||||
return CryptoPrice(getString("base"), getString("currency"), getString("amount").toDouble())
|
||||
}
|
||||
} else {
|
||||
throw CryptoException(message = "Missing price data.")
|
||||
|
|
|
@ -91,7 +91,7 @@ class CryptoPriceTest {
|
|||
assertEquals(price.amount, d, "amount is 57515.69")
|
||||
|
||||
assertFailsWith(
|
||||
message = "double convertion did not fail",
|
||||
message = "double conversion did not fail",
|
||||
exceptionClass = CryptoException::class,
|
||||
block = { json.replace("5", "a").toPrice() }
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue