View Javadoc

1   /*
2    * $Id: AnchorTest.java 630742 2008-02-25 06:26:12Z rgielen $
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  package org.apache.struts2.views.jsp.ui;
22  
23  import org.apache.struts2.TestAction;
24  import org.apache.struts2.views.jsp.AbstractUITagTest;
25  
26  
27  /***
28   */
29  public class AnchorTest extends AbstractUITagTest {
30  
31  
32      public void testSimple() throws Exception {
33          TestAction testAction = (TestAction) action;
34          testAction.setFoo("bar");
35  
36          AnchorTag tag = new AnchorTag();
37          tag.setPageContext(pageContext);
38  
39          tag.setId("mylink");
40          tag.setTheme("ajax");
41          tag.setHref("a");
42          tag.setErrorText("c");
43          tag.setLoadingText("d");
44          tag.setAfterLoading("e");
45          tag.setBeforeLoading("f");
46          tag.setListenTopics("g");
47          tag.setTargets("h");
48          tag.setHandler("i");
49          tag.setNotifyTopics("j");
50          tag.setIndicator("k");
51          tag.setShowErrorTransportText("true");
52          tag.setShowLoadingText("true");
53          tag.doStartTag();
54          tag.doEndTag();
55  
56          verify(AnchorTest.class.getResource("href-1.txt"));
57      }
58  
59      public void testSimpleBadQuote() throws Exception {
60          TestAction testAction = (TestAction) action;
61          testAction.setFoo("bar");
62  
63          AnchorTag tag = new AnchorTag();
64          tag.setPageContext(pageContext);
65  
66          tag.setId("mylink");
67          tag.setHref("a\"");
68          tag.doStartTag();
69          tag.doEndTag();
70  
71          verify(AnchorTest.class.getResource("href-2.txt"));
72      }
73  }