File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Testing and the fly likes How to write junit tests for a method which has LoggingEvent  object type as argument Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "How to write junit tests for a method which has LoggingEvent  object type as argument" Watch "How to write junit tests for a method which has LoggingEvent  object type as argument" New topic
Author

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

Kamal Ahmed
Ranch Hand

Joined: Feb 15, 2005
Posts: 91
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

Joined: Feb 15, 2005
Posts: 91
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to write junit tests for a method which has LoggingEvent object type as argument