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

📄 customtagtest.java

📁 OS(OpenSymphony)的SiteMesh是一个用来在JSP中实现页面布局和装饰(layout and decoration)的框架组件
💻 JAVA
字号:
package com.opensymphony.module.sitemesh.html;import junit.framework.TestCase;public class CustomTagTest extends TestCase {    public void testWritesOutUserDefinedTag() {        assertEquals("<hello/>", new CustomTag("hello", Tag.EMPTY).getContents());        assertEquals("<hello>", new CustomTag("hello", Tag.OPEN).getContents());        assertEquals("</hello>", new CustomTag("hello", Tag.CLOSE).getContents());    }    public void testWritesAttributes() {        CustomTag tag = new CustomTag("hello", Tag.EMPTY);        tag.addAttribute("color", "green");        tag.addAttribute("stuff", null);        assertEquals("<hello color=\"green\" stuff/>", tag.getContents());    }    public void testAllowsAttributesToBeManipulated() {        CustomTag tag = new CustomTag("hello", Tag.OPEN);        assertEquals("<hello>", tag.getContents());        tag.addAttribute("a", "aaa");        tag.addAttribute("b", "bbb");        assertEquals("<hello a=\"aaa\" b=\"bbb\">", tag.getContents());        tag.removeAttribute("b", false);        assertEquals("<hello a=\"aaa\">", tag.getContents());        tag.setAttributeValue("a", false, "zzz");        assertEquals("<hello a=\"zzz\">", tag.getContents());              tag.addAttribute("c", "ccc");        int index = tag.getAttributeIndex("c", true);        assertEquals(1, index);        assertEquals("ccc", tag.getAttributeValue(index));        assertEquals("c", tag.getAttributeName(index));    }}

⌨️ 快捷键说明

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