📄 classutilstest.java
字号:
package org.apache.myfaces.util;import junit.framework.TestCase;/** * @author Manfred Geiler (latest modification by $Author: matze $) * @version $Revision: 1.3 $ $Date: 2004/10/13 11:50:59 $ * $Log: ClassUtilsTest.java,v $ * Revision 1.3 2004/10/13 11:50:59 matze * renamed packages to org.apache * * Revision 1.2 2004/10/05 22:34:20 dave0000 * bug 1021656 with related improvements * */public class ClassUtilsTest extends TestCase{ public void testClassForName() throws ClassNotFoundException { assertEquals(ClassUtils.classForName("java.lang.String"), String.class); try { ClassUtils.classForName("x.y.NotFound"); assertTrue("ClassNotFoundException expected", false); } catch (ClassNotFoundException e) { // ignore, must trow this exception } try { ClassUtils.classForName("java.lang.String[]"); assertTrue("ClassNotFoundException expected", false); } catch (ClassNotFoundException e) { // ignore, must trow this exception } try { ClassUtils.classForName("int"); assertTrue("ClassNotFoundException expected", false); } catch (ClassNotFoundException e) { // ignore, must trow this exception } } public void testJavaTypeToClass() throws ClassNotFoundException { assertEquals(ClassUtils.javaTypeToClass("java.lang.String"), String.class); try { ClassUtils.javaTypeToClass("x.y.NotFound"); assertTrue("ClassNotFoundException expected", false); } catch (ClassNotFoundException e) { // ignore, must trow this exception } assertEquals(ClassUtils.javaTypeToClass("java.lang.String[]"), (new String[0]).getClass()); assertEquals(ClassUtils.javaTypeToClass("int"), Integer.TYPE); assertEquals(ClassUtils.javaTypeToClass("int[]"), (new int[0]).getClass()); try { ClassUtils.javaTypeToClass("int[][]"); assertTrue("ClassNotFoundException expected", false); } catch (ClassNotFoundException e) { // ignore, must trow this exception } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -