01: /**
02: * Copyright 2006 Webmedia Group Ltd.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: **/package org.araneaframework.tests.jsp;
16:
17: import junit.framework.TestCase;
18: import org.araneaframework.jsp.util.JspStringUtil;
19:
20: /**
21: * @author Konstantin Tretyakov
22: */
23: public class StringUtilTest extends TestCase {
24:
25: public StringUtilTest(String name) {
26: super (name);
27: }
28:
29: public void testStringUtils() {
30: // underlineAccessKey
31: assertEquals(JspStringUtil.underlineAccessKey("", ""), "");
32: assertEquals(JspStringUtil.underlineAccessKey("aaa", ""), "aaa");
33: assertNull(JspStringUtil.underlineAccessKey(null, "a"));
34: assertEquals(JspStringUtil.underlineAccessKey("Some string",
35: "So"), "Some string");
36: assertEquals(JspStringUtil.underlineAccessKey("Some string",
37: null), "Some string");
38: assertEquals(JspStringUtil.underlineAccessKey("Some string",
39: "s"), "<u>S</u>ome string");
40: assertEquals(JspStringUtil.underlineAccessKey("s", "s"),
41: "<u>s</u>");
42: assertEquals(JspStringUtil.underlineAccessKey(
43: " \n\tõüöä\n\t", "Õ"), " \n\t<u>õ</u>üöä\n\t");
44: assertEquals(JspStringUtil.underlineAccessKey("<u>this</u>",
45: "U"), "<<u>u</u>>this</u>");
46: }
47: }
|