@@ -72,7 +72,7 @@ class ProxyServerSpec extends Specification {
|
||||
def "Return error on invalid request"() {
|
||||
setup:
|
||||
ReadRpcJson read = Mock(ReadRpcJson) {
|
||||
1 * apply(_) >> { throw new RpcException(-32123, "test", new JsonRpcResponse.IntId(4)) }
|
||||
1 * apply(_) >> { throw new RpcException(-32123, "test", new JsonRpcResponse.NumberId(4)) }
|
||||
}
|
||||
def server = new ProxyServer(
|
||||
Stub(ProxyConfig),
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package io.emeraldpay.dshackle.proxy
|
||||
|
||||
import io.emeraldpay.dshackle.test.TestingCommons
|
||||
|
||||
import io.emeraldpay.dshackle.upstream.rpcclient.JsonRpcResponse
|
||||
import io.infinitape.etherjar.rpc.RpcException
|
||||
import spock.lang.Specification
|
||||
@@ -192,7 +192,7 @@ class ReadRpcJsonSpec extends Specification {
|
||||
def t = thrown(RpcException)
|
||||
t.code == -32600
|
||||
t.rpcMessage.toLowerCase() == "jsonrpc version is not set"
|
||||
t.details == new JsonRpcResponse.IntId(2)
|
||||
t.details == new JsonRpcResponse.NumberId(2)
|
||||
}
|
||||
|
||||
def "Error if jsonrpc version is invalid"() {
|
||||
@@ -202,7 +202,7 @@ class ReadRpcJsonSpec extends Specification {
|
||||
def t = thrown(RpcException)
|
||||
t.code == -32600
|
||||
t.rpcMessage.toLowerCase() == "unsupported json rpc version: 3.0"
|
||||
t.details == new JsonRpcResponse.IntId(2)
|
||||
t.details == new JsonRpcResponse.NumberId(2)
|
||||
}
|
||||
|
||||
def "Error if method is not set"() {
|
||||
@@ -212,7 +212,7 @@ class ReadRpcJsonSpec extends Specification {
|
||||
def t = thrown(RpcException)
|
||||
t.code == -32600
|
||||
t.rpcMessage.toLowerCase() == "method is not set"
|
||||
t.details == new JsonRpcResponse.IntId(2)
|
||||
t.details == new JsonRpcResponse.NumberId(2)
|
||||
}
|
||||
|
||||
def "Error if params is not array"() {
|
||||
@@ -222,6 +222,6 @@ class ReadRpcJsonSpec extends Specification {
|
||||
def t = thrown(RpcException)
|
||||
t.code == -32600
|
||||
t.rpcMessage.toLowerCase() == "params must be an array"
|
||||
t.details == new JsonRpcResponse.IntId(2)
|
||||
t.details == new JsonRpcResponse.NumberId(2)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class JsonRpcResponseSpec extends Specification {
|
||||
|
||||
def "Serialize int id and null result"() {
|
||||
setup:
|
||||
def json = new JsonRpcResponse("null".bytes, null, new JsonRpcResponse.IntId(1))
|
||||
def json = new JsonRpcResponse("null".bytes, null, new JsonRpcResponse.NumberId(1))
|
||||
when:
|
||||
def act = objectMapper.writeValueAsString(json)
|
||||
then:
|
||||
@@ -72,7 +72,7 @@ class JsonRpcResponseSpec extends Specification {
|
||||
|
||||
def "Serialize int id and string result"() {
|
||||
setup:
|
||||
def json = new JsonRpcResponse('"Hello World"'.bytes, null, new JsonRpcResponse.IntId(10))
|
||||
def json = new JsonRpcResponse('"Hello World"'.bytes, null, new JsonRpcResponse.NumberId(10))
|
||||
when:
|
||||
def act = objectMapper.writeValueAsString(json)
|
||||
then:
|
||||
@@ -81,7 +81,7 @@ class JsonRpcResponseSpec extends Specification {
|
||||
|
||||
def "Serialize int id and object result"() {
|
||||
setup:
|
||||
def json = new JsonRpcResponse('{"foo": "Hello World", "bar": 1}'.bytes, null, new JsonRpcResponse.IntId(101))
|
||||
def json = new JsonRpcResponse('{"foo": "Hello World", "bar": 1}'.bytes, null, new JsonRpcResponse.NumberId(101))
|
||||
when:
|
||||
def act = objectMapper.writeValueAsString(json)
|
||||
then:
|
||||
@@ -90,7 +90,7 @@ class JsonRpcResponseSpec extends Specification {
|
||||
|
||||
def "Serialize int id and error"() {
|
||||
setup:
|
||||
def json = new JsonRpcResponse(null, new JsonRpcError(-32041, "Oooops"), new JsonRpcResponse.IntId(101))
|
||||
def json = new JsonRpcResponse(null, new JsonRpcError(-32041, "Oooops"), new JsonRpcResponse.NumberId(101))
|
||||
when:
|
||||
def act = objectMapper.writeValueAsString(json)
|
||||
then:
|
||||
|
||||
Reference in New Issue
Block a user