1 Reply Latest reply: Oct 2, 2011 1:39 AM by 796440 RSS

    How Static methods are mocked in any Mocking Framework like JMockit?

    866541
      I learnt that we can mock static methods using core java library with PowerMock?Jmockit.Want to understand how it is doing it internally in brief?

      My Understanding:- As we define the mock class in the test case itself(Though there are different ways to create mock class in every framework like using expectation syntax in Jmockit), these framework must be defining custom classloader thru which they must be looking for that class definition inside the testcase itself.Its a Guess. Not sure if it is correct? But even if i am right, preference of classloader hirerchy is boootstraploader then applicationclassloader than customerclassloader. So how does it pick from customerclassloader instead of applicationclassloader ?is there a way we can set the preference of customer class loader above to applicationclassloader ?