• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to write junit tests for a method which has LoggingEvent object type as argument

 
Kamal Ahmed
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a Method (see below):



Now i need to write a junit test for this, but I am not sure WHERE to start?
1. Should i create a NEW instance of the class this method belongs to? first.
2. How do i get an "inEvent" of type LoggingEvent?
3. So this is how i start writing test case for the method:



Since WmLoggerFilter is the class that contains testdecide()

I would appreciate any help.

Thanks,
-Kamal.
 
Kamal Ahmed
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P.S:

Should i create a Logger, adn then attach an Appender to it, and then do a


and the test message would serve as object of type LoggingEvent?
But "test message" is a String
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic