新版本还是有问题,在没有传递class参数时,重载还是会调错方法
((JSONObject) arg).toJavaObject(type);
这句话不管属性是否匹配,都能转换成功,没有太大的意义。
我在DemoService添加一个方法
String getPerson(Yee yee);
public class Yee implements Serializable {
private String address;
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
UT:
@Test
public void testInvokeMultiJsonParamMethod2() throws RemotingException {
mockChannel = mock(Channel.class);
given(mockChannel.getAttribute("telnet.service")).willReturn(null);
given(mockChannel.getLocalAddress()).willReturn(NetUtils.toAddress("
127.0.0.1:5555"));
given(mockChannel.getRemoteAddress()).willReturn(NetUtils.toAddress("
127.0.0.1:20886"));
ProviderModel providerModel = new
ProviderModel("org.apache.dubbo.rpc.protocol.dubbo.support.DemoService",
new DemoServiceImpl(), DemoService.class);
ApplicationModel.initProviderModel("org.apache.dubbo.rpc.protocol.dubbo.support.DemoService",
providerModel);
String param = "{\"address\":\"Dubbo\"}";
String result = invoke.telnet(mockChannel, "getPerson(" + param +
")");
assertTrue(result.contains("result: \"Dubbo"));
}
无法测试成功,他会调用String getPerson(Man man);方法
LiZhenNet <[email protected]> 于2019年1月9日周三 上午11:24写道:
> Yes ,I have added UT to cover this。
>
> Ian Luo <[email protected]> 于2019年1月9日周三 上午10:57写道:
>
> > I see. I have not considered the overridden scenario carefully. Thanks
> for
> > your clarification. BTW, do we have the corresponding unit test to cover
> > this?
> >
> > Thanks,
> > -Ian.
> >
> >
> > On Tue, Jan 8, 2019 at 5:50 PM LiZhenNet <[email protected]> wrote:
> >
> > > @beiwei30
> > >
> > > I think your suggestion maybe not right, I have added a comment ,please
> > > take a look.
> > >
> >
>