stringutilstest.java

来自「如题ServletJSP.rar 为网络收集的JSP网站源文件」· Java 代码 · 共 34 行

JAVA
34
字号
/*
 * XP Forum
 *
 * Copyright (c) 2002-2003 RedSoft Group.  All rights reserved.
 *
 */
package org.redsoft.forum.util;

import junit.framework.TestCase;

/**
 * Class Description here
 *
 * @author <a href="mailto:jwtronics@yahoo.com">John Wong</a>
 *
 * @version $Id: StringUtilsTest.java,v 1.1.1.1 2003/07/08 08:25:17 cinc Exp $
 */
public class StringUtilsTest extends TestCase {
	public StringUtilsTest(String theName) {
		super(theName);
	}

	public void testReplaceNewLine() {
		assertEquals("Null string", null, StringUtils.escapeHTMLTags(null));
		assertEquals("Escape < and >", "This is a test &lt;string&gt;.", StringUtils.escapeHTMLTags("This is a test <string>."));
	}

	public void testEscapeHTMLTags() {
		assertEquals("Null string", null, StringUtils.replaceNewLine(null));
		assertEquals("Escape new line", "This&nbsp;is&nbsp;a&nbsp;test&nbsp;<br>&nbsp;hehee.", StringUtils.replaceNewLine("This is a test \n hehee."));
	}

}//EOC

⌨️ 快捷键说明

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