You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by "yhs0092 (via GitHub)" <gi...@apache.org> on 2023/03/31 06:25:37 UTC

[GitHub] [servicecomb-java-chassis] yhs0092 opened a new issue, #3739: TestRestClientInvocation的单元测试无法有效验证功能

yhs0092 opened a new issue, #3739:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3739

   问题出在 `TestRestClientInvocation` 的 `testSetCseContext_enable_unicode` 方法和 `testSetCseContext_disable_unicode` 方法中, 两个方法都是开头对`invocation.getContext()`进行mock, 结尾又调用`invocation.getContext()`获取结果进行校验, 获取的结果就是mock返回, 所以达不到测试的预期效果. 1.3.x 和 2.8.x 分支均有此问题, 建议优化一下UT代码.
   
   https://github.com/apache/servicecomb-java-chassis/blob/21d4b4863b71332f151eb63020f4e9ac51583002/transports/transport-rest/transport-rest-client/src/test/java/org/apache/servicecomb/transport/rest/client/http/TestRestClientInvocation.java#L282-L346


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [servicecomb-java-chassis] lbc97 commented on issue #3739: TestRestClientInvocation的单元测试无法有效验证功能

Posted by "lbc97 (via GitHub)" <gi...@apache.org>.
lbc97 commented on issue #3739:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3739#issuecomment-1515669176

   这个测试本身我试过了是可以通过的 我没发现问题在哪儿 你是说这个测试方法本身要验证的点就是不对的吗


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [servicecomb-java-chassis] yhs0092 commented on issue #3739: TestRestClientInvocation的单元测试无法有效验证功能

Posted by "yhs0092 (via GitHub)" <gi...@apache.org>.
yhs0092 commented on issue #3739:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3739#issuecomment-1538260625

   > 你是说这个测试方法本身要验证的点就是不对的吗
   
   是的, `invocation.getContext()` 方法本身被 mock 了, 所以你在单元测试方法最后取的测试值是mock数据`contextMap`里面的值, 而非UT中经过计算转换的值.
   
   你可以试一下把`org.apache.servicecomb.transport.rest.client.http.RestClientInvocation#setCseContext` 和 `org.apache.servicecomb.common.rest.AbstractRestInvocation#setContext`都注释掉, 不会影响你这个单元测试的结果.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org