Skip to content

Commit 19f7ba6

Browse files
author
dgeorgiev
committed
Merge branch 'release/1.1.0'
2 parents ed9a56e + d69978b commit 19f7ba6

3 files changed

Lines changed: 75 additions & 8 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package com.wavesenterprise.sdk.node.client.feign
2+
3+
import com.wavesenterprise.sdk.node.client.http.DataEntryDto
4+
import com.wavesenterprise.sdk.node.client.http.DataEntryDto.Companion.toDomain
5+
import com.wavesenterprise.sdk.node.domain.DataValue
6+
import org.junit.jupiter.api.Assertions.assertEquals
7+
import org.junit.jupiter.api.Assertions.assertTrue
8+
import org.junit.jupiter.api.Test
9+
import org.junit.jupiter.api.assertThrows
10+
import java.util.Base64
11+
12+
class TxMapperTest {
13+
14+
@Test
15+
fun `should correct map to BooleanDataValue`() {
16+
DataEntryDto(
17+
key = "bool",
18+
type = "boolean",
19+
value = true,
20+
).toDomain().also {
21+
assertTrue(it.value is DataValue.BooleanDataValue)
22+
}
23+
}
24+
25+
@Test
26+
fun `should correct map to StringDataValue`() {
27+
DataEntryDto(
28+
key = "str",
29+
type = "string",
30+
value = "test",
31+
).toDomain().also {
32+
assertTrue(it.value is DataValue.StringDataValue)
33+
}
34+
}
35+
36+
@Test
37+
fun `should correct map to IntegerDataValue`() {
38+
DataEntryDto(
39+
key = "int",
40+
type = "integer",
41+
value = 1,
42+
).toDomain().also {
43+
assertTrue(it.value is DataValue.IntegerDataValue)
44+
}
45+
}
46+
47+
@Test
48+
fun `should correct map to BinaryDataValue`() {
49+
DataEntryDto(
50+
key = "bin",
51+
type = "binary",
52+
value = Base64.getEncoder().encodeToString("test".toByteArray()),
53+
).toDomain().also {
54+
assertTrue(it.value is DataValue.BinaryDataValue)
55+
}
56+
}
57+
58+
@Test
59+
fun `should throw exception when unknown type`() {
60+
val incorrectBooleanDataEntryDto = DataEntryDto(
61+
key = "bool",
62+
type = "bool",
63+
value = true,
64+
)
65+
assertThrows<IllegalStateException > {
66+
incorrectBooleanDataEntryDto.toDomain()
67+
}.also {
68+
assertEquals(
69+
"Unknown data type ${incorrectBooleanDataEntryDto.type} for key ${incorrectBooleanDataEntryDto.key}",
70+
it.message
71+
)
72+
}
73+
}
74+
}

we-node-client-http/we-node-client-feign-client/src/test/kotlin/com/wavesenterprise/sdk/node/client/feign/tx/WeTxApiFeignTest.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,6 @@ internal class WeTxApiFeignTest {
4343
assertEquals(250, utxInfo.sizeInBytes)
4444
}
4545

46-
// @Test
47-
// fun `should get utxInfo`() {
48-
// weTxApi.utxTxs()[0].apply {
49-
// assertEquals("", )
50-
// }
51-
// }
52-
5346
@Test
5447
fun `should successfully sign SignRequest`() {
5548
val signedTxResponse: CallContractTxDto = weTxApi.sign(

we-node-client-json/src/main/kotlin/com/wavesenterprise/sdk/node/client/http/DataEntryDto.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ data class DataEntryDto(
1212
) {
1313
companion object {
1414
const val BINARY_TYPE = "binary"
15-
const val BOOLEAN_TYPE = "bool"
15+
const val BOOLEAN_TYPE = "boolean"
1616
const val INTEGER_TYPE = "integer"
1717
const val STRING_TYPE = "string"
1818

0 commit comments

Comments
 (0)