New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ISSUE #4138] Add Unit Test for UrlMappingPattern #4139
Conversation
...n-rocketmq/src/test/java/org/apache/eventmesh/admin/rocketmq/util/UrlMappingPatternTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's OK for me after you remove the old comment // Verify that the compiledUrlMappingPattern field is updated
.
Of course, I have committed the changes. I have a slight confusion in that although the Could you kindly enlighten me on the reasons behind your thoughts, if you don't mind? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, TestUrlMappingPattern. compiledUrlMappingPatternField
is like a basic or goal, without the need for additional explanation. Additionally, I was also influenced by your previous code (which did update the compiledUrlMappingPatternField
in this method).
But your reply reminded me that we can also consider TestUrlMappingPattern. compiledUrlMappingPatternField
as part of the testing logic, rather than just a goal. Under this, that comment was actually OK.
Thank you for your guidance! I agree with your viewpoint. I have reinstated this line of comment, and I would appreciate it if you could kindly approve it when you have a moment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. CC @xwm1992 @qqeasonchen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pil0tXia CI not pass, pls check it
0428e55
to
0d1d142
Compare
…ern rather than TestUrlMappingPattern
@mxsm Hello! I have pulled the latest code from master to fix compile error and made modifications accordingly. 😉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PTAL😊 @xwm1992 |
@lrhkobe PTAL😉 |
Fixes #4138 .
Motivation
The TO-DO mark said that "It is better using Mockito not PowerMockito", so I used Mockito. Although there are private method/field to test in the compile() method of UrlMappingPattern.
Modifications
Use reflections to access private method and field, then write regular expressions.
The Test case passed.
Documentation