krysalis-update/src/test/java/org/apache/depot/update/util/text MessageTests.java,NONE,1.1

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

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

--- NEW FILE: MessageTests.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.update.util.text;

import java.util.Iterator;
import java.util.List;

import junit.framework.TestCase;

public class MessageTests extends TestCase {

	public MessageTests(String name) {
		super(name);
	}

	public void testBundle() throws Exception {
		assertNotNull("Has a Resource Bundle", Messages.l_resourceBundle);
	}

	public void testMessages() throws Exception {
		List inJavaCodes = MessageConstants.getCodes();

		//	Find any in Java but not in resource bundle		
		for (Iterator i = inJavaCodes.iterator(); i.hasNext();) {
			String code = (String) i.next();
			assertNotNull(code, Messages.loadMessageFormat(code));
		}
	}

	public void testForObsolete() throws Exception {
		List inJavaCodes = MessageConstants.getCodes();
		List inResourceCodes = Messages.getCodes();

		// Find any in resource bundle but not in Java
		for (Iterator i = inResourceCodes.iterator(); i.hasNext();) {
			String code = (String) i.next();
			assertTrue("Obsolete : " + code, inJavaCodes.contains(code));
		}
	}

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



-------------------------------------------------------
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/