001 /* 002 * $Id: XMLResourcesTestCase.java 354761 2005-12-07 15:11:58Z niallp $ 003 * $Revision: 354761 $ 004 * $Date: 2005-12-07 15:11:58 +0000 (Wed, 07 Dec 2005) $ 005 * 006 * ==================================================================== 007 * 008 * Copyright 2003-2005 The Apache Software Foundation 009 * 010 * Licensed under the Apache License, Version 2.0 (the "License"); 011 * you may not use this file except in compliance with the License. 012 * You may obtain a copy of the License at 013 * 014 * http://www.apache.org/licenses/LICENSE-2.0 015 * 016 * Unless required by applicable law or agreed to in writing, software 017 * distributed under the License is distributed on an "AS IS" BASIS, 018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 019 * See the License for the specific language governing permissions and 020 * limitations under the License. 021 * 022 */ 023 024 package org.apache.commons.resources.impl; 025 026 import java.net.URL; 027 028 import junit.framework.Test; 029 import junit.framework.TestSuite; 030 031 /** 032 * <p>Unit tests for 033 * <code>org.apache.commons.resources.impl.XMLResources</code>. 034 * </p> 035 */ 036 public class XMLResourcesTestCase extends CollectionResourcesBaseTestCase { 037 038 public XMLResourcesTestCase(String name) { 039 super(name); 040 } 041 042 // Set up instance variables required by this test case 043 public void setUp() throws Exception { 044 factory = new XMLResourcesFactory(); 045 resources = factory.getResources(NAME, getBase()); 046 } 047 048 // Return the tests included in this test suite 049 public static Test suite() { 050 return (new TestSuite(XMLResourcesTestCase.class)); 051 } 052 053 // Tear down the instance variables required by this test case 054 public void tearDown() { 055 resources = null; 056 factory = null; 057 } 058 059 protected String getBase() throws Exception{ 060 URL url = 061 XMLResourcesTestCase.class.getResource 062 ("/org/apache/commons/resources/impl/TestResources.properties"); 063 if (url == null) { 064 fail("URL NOT FOUND"); 065 } 066 String string = url.toExternalForm(); 067 return string.substring(0, string.length() - 11); 068 } 069 070 071 // ------------------------------------------------ Individual Test Methods 072 073 074 // ------------------------------------------------------ Protected Methods 075 076 077 }