/*
 * FindBugs - Find Bugs in Java programs
 * Copyright (C) 2006,2008 University of Maryland
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package edu.umd.cs.findbugs.util;

import edu.umd.cs.findbugs.util.ClassName;
import junit.framework.TestCase;

/**
 * @author pugh
 */
public class ClassNameTest extends TestCase {

	public void testExtractClassName() {
		assertEquals("java/lang/Integer", ClassName.extractClassName("Ljava/lang/Integer;"));
		assertEquals("java/lang/Integer", ClassName.extractClassName("[Ljava/lang/Integer;"));
		assertEquals("java/lang/Integer", ClassName.extractClassName("[[Ljava/lang/Integer;"));
		assertEquals("java/lang/Integer", ClassName.extractClassName("[[[Ljava/lang/Integer;"));
		assertEquals("java/lang/Integer", ClassName.extractClassName("java/lang/Integer"));
	}

	public void testExtractClassNameBad() {
		try {
		ClassName.extractClassName("L[Ljava/lang/Integer;");
		fail();
		} catch (IllegalArgumentException e) {
			assert true;
		}

	}

}

@@ -1017,16 +1017,534 @@
 Case %7B%0A%0A
+%09public void testExtractPackagePrefix() %7B%0A%09%09assertEquals(%22%22, ClassName.extractPackagePrefix(%22org.apache.ant.subpkg.sub2%22, 0));%0A%09%09assertEquals(%22org%22, ClassName.extractPackagePrefix(%22org%22, 1));%0A%09%09assertEquals(%22org.apache.ant%22, ClassName.extractPackagePrefix(%22org.apache.ant.subpkg.sub2%22, 3));%0A%09%09assertEquals(%22org.apache.ant.subpkg.sub2%22, ClassName.extractPackagePrefix(%22org.apache.ant.subpkg.sub2%22, 5));%0A%09%09assertEquals(%22org.apache.ant.subpkg.sub2%22, ClassName.extractPackagePrefix(%22org.apache.ant.subpkg.sub2%22, 6));%0A%09%7D%0A%09%0A
 %09public 

Add test for ClassName.extractPackagePrefix.