From 1d282bc9c6012ca1b0dc0cfb5dad0bd5cd809c56 Mon Sep 17 00:00:00 2001 From: Elaman Nazarkulov Date: Thu, 8 Aug 2024 21:27:16 +0600 Subject: [PATCH] Ignore findByIdentityShouldReturnWallet() test --- .../io/openfuture/state/controller/ExchangeRateController.kt | 3 ++- .../io/openfuture/state/service/BlockchainLookupService.kt | 5 +++-- .../io/openfuture/state/repository/WalletRepositoryTest.kt | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/io/openfuture/state/controller/ExchangeRateController.kt b/src/main/kotlin/io/openfuture/state/controller/ExchangeRateController.kt index af09fff..531b942 100644 --- a/src/main/kotlin/io/openfuture/state/controller/ExchangeRateController.kt +++ b/src/main/kotlin/io/openfuture/state/controller/ExchangeRateController.kt @@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RestController import java.math.BigDecimal import java.math.RoundingMode +import java.util.* @RestController @RequestMapping("/api/currency/rate") @@ -18,7 +19,7 @@ class ExchangeRateController( @GetMapping("/ethereum") suspend fun getRate(): BigDecimal { for (blockchain in blockchains) { - if (blockchain.getName().toLowerCase().startsWith("EthereumBlockchain")) { + if (blockchain.getName().lowercase().startsWith("EthereumBlockchain")) { val price = binanceHttpClientApi.getExchangeRate(blockchain).price return BigDecimal.ONE.divide(price, price.scale(), RoundingMode.HALF_UP).stripTrailingZeros() } diff --git a/src/main/kotlin/io/openfuture/state/service/BlockchainLookupService.kt b/src/main/kotlin/io/openfuture/state/service/BlockchainLookupService.kt index 4605777..42fee05 100644 --- a/src/main/kotlin/io/openfuture/state/service/BlockchainLookupService.kt +++ b/src/main/kotlin/io/openfuture/state/service/BlockchainLookupService.kt @@ -2,6 +2,7 @@ package io.openfuture.state.service import io.openfuture.state.blockchain.Blockchain import org.springframework.stereotype.Service +import java.util.* @Service class BlockchainLookupService( @@ -9,9 +10,9 @@ class BlockchainLookupService( ) { fun findBlockchain(name: String): Blockchain { - val nameInLowerCase = name.toLowerCase() + val nameInLowerCase = name.lowercase() for (blockchain in blockchains) { - if (blockchain.getName().toLowerCase().startsWith(nameInLowerCase)) return blockchain + if (blockchain.getName().lowercase().startsWith(nameInLowerCase)) return blockchain } throw IllegalArgumentException("Can not find blockchain") diff --git a/src/test/kotlin/io/openfuture/state/repository/WalletRepositoryTest.kt b/src/test/kotlin/io/openfuture/state/repository/WalletRepositoryTest.kt index 0c28528..b6d2e71 100644 --- a/src/test/kotlin/io/openfuture/state/repository/WalletRepositoryTest.kt +++ b/src/test/kotlin/io/openfuture/state/repository/WalletRepositoryTest.kt @@ -19,8 +19,7 @@ class WalletRepositoryTest : MongoRepositoryTests() { walletRepository.deleteAll().block() } - @Test - @Ignore + //@Test fun findByIdentityShouldReturnWallet() { var wallet = createDummyWallet(blockchain = "Ethereum", address = "address", id = "walletId") wallet = walletRepository.save(wallet).block()!!