Hi,
Could you please give me some CLUE, on how to proceed to test the following
method:
public int decide(LoggingEvent inEvent) {
boolean retCode = false;
if (inEvent != null) {
Matcher matcher =
targetPattern.matcher(inEvent.getLoggerName());
retCode = (matcher.find() == acceptMatch);
}
return (retCode) ? Filter.NEUTRAL : Filter.DENY;
}
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?
2. How do i get an "inEvent" of type LoggingEvent?
3. So this is how i have started writing test case for the method, decide(),
based on:
The General form of Junit test follows the following steps:
1. Create an object and put it in a known state
2. Invoke a method which returns the "actual result"
3. Create the "expected result" which may be a primitive value or a more
complex object.
4. Invoke "assertEquals(expectedResult,actualResult)
public int testdecide() {
int result=0;
// WmLoggerFilter subjectWmLoggerFilter = new
WmLoggerFilter();
return result;
}
Since WmLoggerFilter is the class that contains testdecide()
I would appreciate any help.
Thanks,
-Kamal.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]