From b6e2da91c002b538a2d972a5ff7f4dadfc9e185a Mon Sep 17 00:00:00 2001 From: Tangem Date: Sat, 10 Sep 2022 13:25:47 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../features/BlockchainNetworkIdTests.kt | 29 +++++++++++++++++++ .../tangem/domain/features/ExampleUnitTest.kt | 16 ---------- 2 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 domain/src/test/java/com/tangem/domain/features/BlockchainNetworkIdTests.kt delete mode 100644 domain/src/test/java/com/tangem/domain/features/ExampleUnitTest.kt diff --git a/domain/src/test/java/com/tangem/domain/features/BlockchainNetworkIdTests.kt b/domain/src/test/java/com/tangem/domain/features/BlockchainNetworkIdTests.kt new file mode 100644 index 0000000000..9982a61c80 --- /dev/null +++ b/domain/src/test/java/com/tangem/domain/features/BlockchainNetworkIdTests.kt @@ -0,0 +1,29 @@ +package com.tangem.domain.features + +import com.google.common.truth.Truth +import com.tangem.blockchain.common.Blockchain +import com.tangem.domain.common.extensions.fromNetworkId +import com.tangem.domain.common.extensions.toNetworkId +import org.junit.Test + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class BlockchainNetworkIdTests { + @Test + fun checkAppropriateImplementationForNetworkIds() { + val unimplementedIds = Blockchain.values() + .toMutableList() + .apply { remove(Blockchain.Unknown) }.map { + val networkId = it.toNetworkId() + networkId to Blockchain.fromNetworkId(networkId) + }.filter { it.second == null } + + if (unimplementedIds.isEmpty()) return + + val message = unimplementedIds.joinToString("\n") { it.first } + Truth.assert_().withMessage(message).fail() + } +} \ No newline at end of file diff --git a/domain/src/test/java/com/tangem/domain/features/ExampleUnitTest.kt b/domain/src/test/java/com/tangem/domain/features/ExampleUnitTest.kt deleted file mode 100644 index 99368f65e4..0000000000 --- a/domain/src/test/java/com/tangem/domain/features/ExampleUnitTest.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.tangem.domain.features - -import org.junit.Assert.assertEquals -import org.junit.Test - -/** - * Example local unit test, which will execute on the development machine (host). - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -class ExampleUnitTest { - @Test - fun addition_isCorrect() { - assertEquals(4, 2 + 2) - } -} \ No newline at end of file