⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intenumtest.java

📁 基于Jabber协议的即时消息服务器
💻 JAVA
字号:
/** * $RCSfile$ * $Revision: 70 $ * $Date: 2004-10-22 10:35:36 -0700 (Fri, 22 Oct 2004) $ * * Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved. * * This software is the proprietary information of CoolServlets, Inc. * Use is subject to license terms. */package org.jivesoftware.util;import junit.framework.TestCase;/** * Simple test of the int enum class. * * @author Iain Shigeoka */public class IntEnumTest extends TestCase {    /**     * Create a test case with a given name.     *     * @param name The name of the test     */    public IntEnumTest (String name){        super(name);    }    static public class TestIntEnum extends IntEnum{        public TestIntEnum(String name, int value){            super(name,value);            register(this);        }        public static TestIntEnum getTypeFromInt(int value){            return (TestIntEnum) getEnumFromInt(TestIntEnum.class,value);        }    }    /**     * Tests the IntEnum's enforcement of unique int values for each enum type     */    public void testStaticEnumUniqueEnforcement(){        IntEnum e = new IntEnum("plain",1);        IntEnum.register(e);        new TestIntEnum("test",1); // auto registers the same value - does it clash with super class?        assertEquals("plain",IntEnum.getEnumFromInt(IntEnum.class,1).getName());        assertEquals("test",TestIntEnum.getTypeFromInt(1).getName());    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -