Open
Conversation
c9b6bcc to
8e1f36e
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #45 +/- ##
=====================================================
+ Coverage 69.41646% 70.46688% +1.05042%
- Complexity 4125 4220 +95
=====================================================
Files 428 428
Lines 16777 16771 -6
Branches 1698 1698
=====================================================
+ Hits 11646 11818 +172
+ Misses 4030 3863 -167
+ Partials 1101 1090 -11
|
4222e3f to
84703c3
Compare
|
|
||
| @Test | ||
| public void testContextLoads() { | ||
| // 测试上下文加载 |
| @Test | ||
| public void testParseCallInfoWithIllegalArgument() { | ||
| try { | ||
| TrpcGatewayClient.parseCallInfo("http://www.abc.com"); |
| public void setUp() { | ||
| config = mock(Config.class); | ||
| factory = new TrpcGatewayFilterFactory(); | ||
| ReflectionTestUtils.setField(factory, "requestRewriter", mock(TrpcRequestRewriter.class)); |
Collaborator
There was a problem hiding this comment.
建议减少使用反射,可以搭建客户端服务端进行单测
|
|
||
| @Test | ||
| public void testLoadRequestRewriterWithNull() { | ||
| String className = "com.tencent.trpc.spring.cloud.gateway.filter.request.MyRequestRewriterTest"; |
|
|
||
| private static final Map<Class<? extends Message>, Builder> cache = new ConcurrentHashMap<>(); | ||
|
|
||
| private static <T extends Message> Builder newBuilder(Class<T> clazz) { |
| import org.junit.Before; | ||
| import org.junit.Test; | ||
|
|
||
| public class PluginsSchemaTest { |
Collaborator
There was a problem hiding this comment.
trpc-spring-support/trpc-spring/src/test/java/com/tencent/trpc/spring/context下面的单测不太符合预期,建议再增加一个单测:启动一个trpc-java服务,有trpc相关配置文件,再去断言配置服务正确读取、解析,插件是否注册成功,以及客户端和服务端正常请求和回包
| import org.junit.Assert; | ||
| import org.junit.Test; | ||
|
|
||
| public class HandleExceptionConfigurerTest { |
Collaborator
There was a problem hiding this comment.
建议增加真实的rpc调用,去触发异常捕获,以及断言
| Assert.assertEquals(Integer.valueOf(eleNumberValue), resolvedAttributes.get(eleNumberKey)); | ||
| } | ||
|
|
||
| // 测试resolvePlaceholders处理字符串数组的情况 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
linked #34
单测覆盖率链接