KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > util > TestPOILogger


1
2 /* ====================================================================
3    Copyright 2002-2004 Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16 ==================================================================== */

17         
18
19 package org.apache.poi.util;
20
21 import junit.framework.TestCase;
22
23 /**
24  * Tests the log class.
25  *
26  * @author Glen Stampoultzis (glens at apache.org)
27  * @author Marc Johnson (mjohnson at apache dot org)
28  * @author Nicola Ken Barozzi (nicolaken at apache.org)
29  */

30
31 public class TestPOILogger
32         extends TestCase
33 {
34     /**
35      * Constructor TestPOILogger
36      *
37      *
38      * @param s
39      *
40      */

41
42     public TestPOILogger( String JavaDoc s )
43     {
44         super( s );
45     }
46
47     /**
48      * Test different types of log output.
49      *
50      * @exception Exception
51      */

52     public void testVariousLogTypes()
53             throws Exception JavaDoc
54     {
55         //NKB Testing only that logging classes use gives no exception
56
// Since logging can be disabled, no checking of logging
57
// output is done.
58

59         POILogger log = POILogFactory.getLogger( "foo" );
60
61         log.log( POILogger.WARN, "Test = ", new Integer JavaDoc( 1 ) );
62         log.logFormatted( POILogger.ERROR, "Test param 1 = %, param 2 = %", "2", new Integer JavaDoc( 3 ) );
63         log.logFormatted( POILogger.ERROR, "Test param 1 = %, param 2 = %", new int[]{4, 5} );
64         log.logFormatted( POILogger.ERROR,
65                 "Test param 1 = %1.1, param 2 = %0.1", new double[]{4, 5.23} );
66
67     }
68 }
69
Popular Tags