• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

testing a private method with JUnit / Coverlipse

 
Kamal Ahmed
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am testing the method:

And since it is private, used call hierarchy to find out that public void setConsoleAppending(boolean append, int outputType) calls this method.

Now in

if (!isSameOutputType(outputType, currentCA)) {
getLog4jLogger().removeAppender(name);

and if I make isSameOutputType(outputType, currentCA)) false, I can verify that :

the Appender is removed.

Now:
In order to make isSameOutPutType() false,
I force the return be false in:

String currCAOutputType = currentCA.getTarget();
return currCAOutputType.equals(ConsoleAppender.SYSTEM_OUT)

Here is my test method:


But, somehow, I am not getting the method isSameOutPutType() covered by coverlipse.

Could anyone please give me a hint?

Thanks,
-Kamal.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic