Pil0tXia commented on code in PR #4139:
URL: https://github.com/apache/eventmesh/pull/4139#discussion_r1236263641
##########
eventmesh-admin/eventmesh-admin-rocketmq/src/test/java/org/apache/eventmesh/admin/rocketmq/util/UrlMappingPatternTest.java:
##########
@@ -86,8 +88,21 @@ public void testGetParamNames() {
}
@Test
- public void testCompile() {
- //TODO : Fix me to test the method compile(). It is better using
Mockito not PowerMockito.
+ public void testCompile() throws NoSuchFieldException,
IllegalAccessException {
+ // Mock the compiledUrlMappingPattern field with reflection
+ Pattern mockedPattern = mock(Pattern.class);
+ Field compiledUrlMappingPatternField =
urlMappingPattern.getClass().getDeclaredField("compiledUrlMappingPattern");
+ compiledUrlMappingPatternField.setAccessible(true);
+ compiledUrlMappingPatternField.set(urlMappingPattern, mockedPattern);
Review Comment:
Thank you! It is really a good idea. I have committed the changes, and
please review it at your ease.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]