KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > barracuda > taskdefs > TestXmlcUtilsCreate


1 /*
2  * Copyright (C) 2003 Christian Cryder [christianc@granitepeaks.com]
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * $Id: TestXmlcUtilsCreate.java,v 1.8 2004/02/01 05:16:33 christianc Exp $
19  */

20 package org.enhydra.barracuda.taskdefs;
21
22 // import junit specifics
23
import junit.framework.TestCase;
24
25 // import logging specifics
26
import org.apache.log4j.Logger;
27
28 // import java specifics
29
import java.io.File JavaDoc;
30
31 import org.enhydra.xml.xmlc.taskdef.*;
32
33 import org.enhydra.barracuda.testbed.*;
34
35 /**
36  * Unit tests for create() factory method of XmlcUtils
37  */

38 public class TestXmlcUtilsCreate extends DefaultTestCase {
39
40     //===========================================================================
41
// CONSTRUCTORS
42
//===========================================================================
43

44     /**
45      * Default constructor
46      *
47      * @param theName The name of the test
48      */

49     public TestXmlcUtilsCreate( String JavaDoc theName) {
50         super( theName );
51     }
52
53     /**
54      * Sets up the fixture, for example, open a network connection.
55      * This method is called before a test is executed.
56      */

57     protected void setUp() throws Exception JavaDoc {
58         super.setUp();
59     }
60
61     /**
62      * Tears down the fixture, for example, close a network connection.
63      * This method is called after a test is executed.
64      */

65     protected void tearDown() throws Exception JavaDoc {
66         super.tearDown();
67     }
68
69     //===========================================================================
70
// TEST METHODS
71
//===========================================================================
72
public void testCreate() {
73         XmlcUtils xmlcUtils = XmlcUtils.create();
74
75         assertEquals( "Default create should return a default implementation",
76                       DefaultXmlcUtilsImpl.class,
77                       xmlcUtils.getClass() );
78
79         System.setProperty(XmlcUtils.DEFAULT_UTILS_CLASS_KEY, String JavaDoc.class.getName() );
80
81         xmlcUtils = XmlcUtils.create();
82
83         assertEquals( "Improper create should return a default implementation",
84                       DefaultXmlcUtilsImpl.class,
85                       xmlcUtils.getClass() );
86
87         System.setProperty(XmlcUtils.DEFAULT_UTILS_CLASS_KEY, DummyXmlcUtils.class.getName() );
88
89         xmlcUtils = XmlcUtils.create();
90
91         assertEquals( "Improper create should return dummy implementation",
92                       DummyXmlcUtils.class,
93                       xmlcUtils.getClass() );
94     }
95
96     //===========================================================================
97
// DATA MEMBERS
98
//===========================================================================
99

100     //===========================================================================
101
// STATIC DATA MEMBERS
102
//===========================================================================
103

104     // setup the loggger for this class
105
private static final Logger theirLogger = Logger.getLogger( TestXmlcUtilsCreate.class.getName() );
106
107 }
108
Popular Tags