You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/09/27 09:16:25 UTC

[GitHub] [pulsar] tisonkun commented on a diff in pull request #17851: [fix][tests] Fix Mockito mocks memory leak

tisonkun commented on code in PR #17851:
URL: https://github.com/apache/pulsar/pull/17851#discussion_r980987160


##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/BrokerTestUtil.java:
##########
@@ -44,4 +44,19 @@ public static <T> T spyWithClassAndConstructorArgs(Class<T> classToSpy, Object..
                 .useConstructor(args)
                 .defaultAnswer(Mockito.CALLS_REAL_METHODS));
     }
+
+    /**
+     * Create a Mockito spy that is stub-only which does not record method invocations,
+     * thus saving memory but disallowing verification of invocations.

Review Comment:
   > but disallowing verification of invocations
   
   If so, can we replace `spy(obj)` with bare `obj`?



-- 
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@pulsar.apache.org

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