11package io.openfuture.api.component.state
22
33import io.openfuture.api.config.UnitTest
4- import io.openfuture.api.domain.state.CreateStateWalletRequest
5- import io.openfuture.api.domain.state.StateWalletDto
4+ import io.openfuture.api.domain.key.KeyWalletDto
5+ import io.openfuture.api.domain.state.*
66import io.openfuture.api.entity.state.Blockchain
7+ import io.openfuture.api.util.getOrderKey
8+ import io.openfuture.api.util.getRandomNumber
79import org.assertj.core.api.Assertions
810import org.junit.Before
911import org.junit.Test
@@ -12,6 +14,7 @@ import org.mockito.Mock
1214import org.springframework.http.HttpStatus
1315import org.springframework.http.ResponseEntity
1416import org.springframework.web.client.RestTemplate
17+ import java.math.BigDecimal
1518import java.time.LocalDateTime
1619
1720class DefaultStateApiTests : UnitTest () {
@@ -28,11 +31,27 @@ class DefaultStateApiTests : UnitTest() {
2831
2932 @Test
3033 fun createWalletTest () {
31- val request = CreateStateWalletRequest (" address" , " webhook" , Blockchain .Ethereum )
32- val response = StateWalletDto (" id" , " address" , " webhook" , Blockchain .Ethereum , LocalDateTime .now())
33-
34- given(restTemplate.postForEntity(" /wallets" , request, StateWalletDto ::class .java))
35- .willReturn(ResponseEntity (response, HttpStatus .OK ))
34+ val request = CreateStateWalletRequestMetadata (
35+ " webhook" ,
36+ listOf (KeyWalletDto (" address" , Blockchain .Ethereum .getValue())),
37+ WalletMetaData (
38+ " 0" ,
39+ " 1000" ,
40+ " op_UxQr1LLdREboF" ,
41+ " USD" ,
42+ " open" ,
43+ false
44+ )
45+ )
46+ val response = CreateStateWalletResponse (
47+ " webhook" ,
48+ " 100" ,
49+ " op_UxQr1LLdREboF" ,
50+ BigDecimal .ZERO ,
51+ listOf (WalletCreateResponse (Blockchain .Ethereum .getValue()," address" , BigDecimal .ZERO ))
52+ )
53+
54+ given(restTemplate.postForEntity(" /wallets" , request, CreateStateWalletResponse ::class .java)).willReturn(ResponseEntity (response, HttpStatus .OK ))
3655
3756 val result = stateApi.createWallet(" address" , " webhook" , Blockchain .Ethereum )
3857
0 commit comments