commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hope, Matthew" <Matthew.H...@capitalone.com>
Subject RE: [digester] turning off commons-logging for unit tests
Date Wed, 01 Oct 2003 09:58:45 GMT
Would suggest putting the resetting of the old logger in the tearDown()
method...

I have to do this a lot a the moment where all unit tests are run through
irrespective of the result of others and this means you don't run any risk
of losing the output.

Finally will do the same but Junit provides this sort of method for a
reason...

-----Original Message-----
From: Simon Kitching [mailto:simon@ecnetwork.co.nz] 
Sent: 01 October 2003 02:14
To: Jakarta Commons Developers List
Subject: Re: [digester] turning off commons-logging for unit tests


On Wed, 2003-10-01 at 13:06, Simon Kitching wrote:
>  
>  try {
>      Log oldLog = digester.getLogger();
>      digester.setLogger(new NoOpLog());
>      digester.parse(
>         TestAll.getInputStream(this, "test2.xml"));
>      digester.setLogger(oldLog);
>   }
>   catch(Exception e) {
>     // yay - exception was correctly generated
>     // ....
>   }

hmm..try

 Log oldLog = digester.getLogger();
 try {
    digester.setLogger(new NoOpLog());
    digester.parse(
      TestAll.getInputStream(this, "test2.xml"));
 }
 catch(Exception e) {
     // yay ... etc
 }
 finally {
   digester.setLogger(oldLog);
 }

:-)

In fact, it probably doesn't matter a damn about restoring the old logger,
as the test has failed. Still, don't want anyone thinking I can't handle
exceptions properly!


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
 
**************************************************************************
The information transmitted herewith is sensitive information intended only
for use by the individual or entity to which it is addressed. If the reader
of this message is not the intended recipient, you are hereby notified that
any review, retransmission, dissemination, distribution, copying or other
use of, or taking of any action in reliance upon this information is
strictly prohibited. If you have received this communication in error,
please contact the sender and delete the material from your computer.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message