This commit is contained in:
Erik C. Thauvin 2021-05-09 16:15:22 -07:00
parent 3ad86b3354
commit 4209cb83c5
3 changed files with 10 additions and 7 deletions

3
.idea/misc.xml generated
View file

@ -2,4 +2,7 @@
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="15" project-jdk-type="JavaSDK" /> <component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="15" project-jdk-type="JavaSDK" />
<component name="SuppressKotlinCodeStyleNotification">
<option name="disableForAll" value="true" />
</component>
</project> </project>

View file

@ -53,7 +53,7 @@ open class CryptoPrice(val base: String, val currency: String, val amount: Doubl
if (json.has("data")) { if (json.has("data")) {
with(json.getJSONObject("data")) { with(json.getJSONObject("data")) {
return CryptoPrice( return CryptoPrice(
getString("base"), getString("currency"), getString("amount").toDouble() getString("base"), getString("currency"), getString("amount").toDouble()
) )
} }
} else { } else {

View file

@ -52,15 +52,15 @@ class CryptoPriceTest {
@Throws(CryptoException::class) @Throws(CryptoException::class)
fun testMarketPriceExceptions() { fun testMarketPriceExceptions() {
assertFailsWith( assertFailsWith(
message = "FOO did not fail", message = "FOO did not fail",
exceptionClass = CryptoException::class, exceptionClass = CryptoException::class,
block = { marketPrice("FOO") } block = { marketPrice("FOO") }
) )
assertFailsWith( assertFailsWith(
message = "BAR did not fail", message = "BAR did not fail",
exceptionClass = CryptoException::class, exceptionClass = CryptoException::class,
block = { marketPrice("BTC", "BAR") } block = { marketPrice("BTC", "BAR") }
) )
try { try {