You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "SANSONE, AARON M [Non-Pharmacia/1000]" <aa...@monsanto.com> on 2001/10/19 17:51:21 UTC

JUnit Testing Actions with Logging...

Hello everyone,

In Cocoon2 has anyone successfully configured a JUnit test case that will
run an Action (or any other class) that has logging method calls in it? 

For example, I have an action that I am able to Unit test with out any
problem until I add the following (line 45):

    getLogger().debug("CheckBoxAggregateAction: parameter useCheckedValue =
" + params.getParameter("useCheckedValue", "FALSE") );

After adding this line, my JUnit tests fail with the following exception:

java.lang.NullPointerException 	
	at
com.test.acting.CheckBoxAggregateAction.act(CheckBoxAggregateAction.java:45)

	at
com.test.acting.test.UnitTest_CheckboxAggregateAction.testUseCheckedValue(Un
itTest_CheckboxAggregateAction.java:68) 

Apparently this is failing because I can't get a Logger.  I don't want to
create a logger in the Action and I can run the action successfully within
the Cocoon2 Framework. 
How do I setup my TestCase to create a logger so that my Unit Tests will
work?

Thanks in advance,

Aaron

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org