01: /* ====================================================================
02: Licensed to the Apache Software Foundation (ASF) under one or more
03: contributor license agreements. See the NOTICE file distributed with
04: this work for additional information regarding copyright ownership.
05: The ASF licenses this file to You under the Apache License, Version 2.0
06: (the "License"); you may not use this file except in compliance with
07: the License. You may obtain a copy of the License at
08:
09: 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: package org.apache.poi.util;
19:
20: import junit.framework.TestCase;
21:
22: import java.io.IOException;
23:
24: /**
25: * @author Marc Johnson (mjohnson at apache dot org)
26: * @author Glen Stampoultzis (glens at apache.org)
27: * @author Nicola Ken Barozzi (nicolaken at apache.org)
28: */
29:
30: public class TestPOILogFactory extends TestCase {
31: /**
32: * Creates new TestPOILogFactory
33: *
34: * @param name
35: */
36:
37: public TestPOILogFactory(String name) {
38: super (name);
39: }
40:
41: /**
42: * test log creation
43: *
44: * @exception IOException
45: */
46:
47: public void testLog() throws IOException {
48: //NKB Testing only that logging classes use gives no exception
49: // Since logging can be disabled, no checking of logging
50: // output is done.
51:
52: POILogger l1 = POILogFactory
53: .getLogger("org.apache.poi.hssf.test");
54: POILogger l2 = POILogFactory
55: .getLogger("org.apache.poi.hdf.test");
56:
57: l1.log(POILogger.FATAL,
58: "testing cat org.apache.poi.hssf.*:FATAL");
59: l1.log(POILogger.ERROR,
60: "testing cat org.apache.poi.hssf.*:ERROR");
61: l1
62: .log(POILogger.WARN,
63: "testing cat org.apache.poi.hssf.*:WARN");
64: l1
65: .log(POILogger.INFO,
66: "testing cat org.apache.poi.hssf.*:INFO");
67: l1.log(POILogger.DEBUG,
68: "testing cat org.apache.poi.hssf.*:DEBUG");
69:
70: l2.log(POILogger.FATAL,
71: "testing cat org.apache.poi.hdf.*:FATAL");
72: l2.log(POILogger.ERROR,
73: "testing cat org.apache.poi.hdf.*:ERROR");
74: l2.log(POILogger.WARN, "testing cat org.apache.poi.hdf.*:WARN");
75: l2.log(POILogger.INFO, "testing cat org.apache.poi.hdf.*:INFO");
76: l2.log(POILogger.DEBUG,
77: "testing cat org.apache.poi.hdf.*:DEBUG");
78:
79: }
80:
81: /**
82: * main method to run the unit tests
83: *
84: * @param ignored_args
85: */
86:
87: public static void main(String[] ignored_args) {
88: System.out
89: .println("Testing basic util.POILogFactory functionality");
90: junit.textui.TestRunner.run(TestPOILogFactory.class);
91: }
92: }
|