001 /* 002 * $Id: TestResourcesFactory.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 org.apache.commons.resources.Resources; 027 import org.apache.commons.resources.ResourcesException; 028 029 /** 030 * <p>Concrete implementation of {@link ResourcesFactory} for unit tests.</p> 031 */ 032 public class TestResourcesFactory extends ResourcesFactoryBase { 033 034 /** 035 * <p>Create and return a new {@link Resources} instance with the 036 * specified logical name, after calling its <code>init()</code> 037 * method.</p> 038 * 039 * @param name Logical name of the {@link Resources} instance to create 040 * @param config Configuration string for this resource (if any) 041 * 042 * @exception ResourcesException if a {@link Resources} instance 043 * of the specified logical name cannot be created. 044 */ 045 protected Resources createResources(String name, String config) 046 throws ResourcesException { 047 048 Resources res = new TestResources(name); 049 res.init(); 050 res.setReturnNull(isReturnNull()); 051 return (res); 052 053 } 054 055 056 }