krysalis-update/src/test/java/org/apache/depot/common/util RegistryTests.java,NONE,1.1

Nick Chalko <[email protected]> Wed, 08 Dec 2004 09:07:09 +0000
Newsgroups gmane.comp.krysalis.cvs
Message-ID <[email protected]>
Update of /cvsroot/krysalis/krysalis-update/src/test/java/org/apache/depot/common/util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24726/src/test/java/org/apache/depot/common/util

Added Files:
	RegistryTests.java 
Log Message:
Copied from the apache incubator.

--- NEW FILE: RegistryTests.java ---
/*
 * Copyright  2004 The Apache Software Foundation
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package org.apache.depot.common.util;

import junit.framework.TestCase;

import org.apache.depot.common.DepotError;

/**
 * @author ajack
 */
public class RegistryTests extends TestCase {

	public RegistryTests(String arg0) {
		super(arg0);
	}

	public static void main(String[] args) {
		junit.textui.TestRunner.run(RegistryTests.class);
	}

	public void testRegistry() {

		Registry registry = new Registry();

		registry.put("A");
		registry.put("A");
		registry.put("A");

		assertTrue("Entries", 1 == registry.size());
	}

	public void testUniqueRegistry() {

		try {
			Registry registry = new Registry(true);

			registry.put("A");
			registry.put("A");
			registry.put("A");

			fail("Ought enforce unique");
		}
		catch (DepotError e) {
		}
	}
}



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/