Add test for exception being thrown

This commit is contained in:
Sudarsan Balaji 2021-10-14 00:06:17 +05:30
parent 1864a3e6ba
commit 42582158bf

View File

@ -3,7 +3,6 @@ package uniffi.bdk
import uniffi.bdk.OfflineWallet
import org.junit.Assert.*
import org.junit.Test
import java.io.File
/**
* Library tests which will execute for jvm and android modules.
@ -13,13 +12,16 @@ class LibTest {
val desc =
"wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8Tm4jsS3iuEmKjTiEGjG6KnuFNKKJb5A6ZUCUZKdvLdSDWofKi4ToRCwb9poe1XdqfUnP4jaJjCB2Zwv11ZLgSbnZSNecE/0/*)"
@Test
fun walletNewAddress() {
val wallet = OfflineWallet(desc)
val address = wallet.getNewAddress()
println("address:" + address)
assertNotNull(address)
// log.debug("address created from bdk-kotlin: $address")
assertEquals(address, "bcrt1qzg4mckdh50nwdm9hkzq06528rsu73hjxytqkxs")
// @Test
// fun walletNewAddress() {
// val wallet = OfflineWallet(desc)
// val address = wallet.getNewAddress()
// assertNotNull(address)
// assertEquals(address, "bcrt1qzg4mckdh50nwdm9hkzq06528rsu73hjxytqkxs")
// }
@Test(expected=BdkException.Descriptor::class)
fun invalidDescriptorExceptionIsThrown() {
OfflineWallet("invalid-descriptor")
}
}