This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help in understanding JMockit Usage

 
Raghavan saraghav
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Am a newbie to the Junit and JMockit. I havent used any other mock tools before and thought of deciding to give a try with JMockit. Am trying a simple example and am not able to solve the problem. I have 3 classes namely Logger, Base Class and a Derived Class and all of three resides in 3 different packages

1. The Logger class which is final and has a private constructor and has a method call log(String message)
2. The Base Class has a getter/setter for the Logger which currently am not aware of who is setting it
3. The derived class is my class under testing which uses the logger set by the base class. [example. logger.log("some message")] and say performOperation is my method which i want to test.

Hope the above points clarify the scenario.

My intention is to test the performOperation alone in the derived class. Should i mock the setter of base class and also the Logger class itself as i cannot instantiate it from outside. Suggest me what approach should i take to test my method alone
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic