1 package org.displaytag.properties;
2
3 import org.displaytag.test.DisplaytagCase;
4
5 import com.meterware.httpunit.GetMethodWebRequest;
6 import com.meterware.httpunit.WebRequest;
7 import com.meterware.httpunit.WebResponse;
8 import com.meterware.httpunit.WebTable;
9
10
11 /**
12 * Tests for "titlekey" column attribute.
13 * @author Fabrizio Giustina
14 * @version $Revision: 707 $ ($Author: fgiust $)
15 */
16 public class TitleKeyJstlFmtBundleTest extends DisplaytagCase
17 {
18
19 /**
20 * @see org.displaytag.test.DisplaytagCase#getJspName()
21 */
22 public String getJspName()
23 {
24 return "titlekeyfmtbundle.jsp";
25 }
26
27 /**
28 * Test that headers are correctly removed.
29 * @param jspName jsp name, with full path
30 * @throws Exception any axception thrown during test.
31 */
32 public void doTest(String jspName) throws Exception
33 {
34 // test keep
35 WebRequest request = new GetMethodWebRequest(jspName);
36
37 WebResponse response = runner.getResponse(request);
38
39 if (log.isDebugEnabled())
40 {
41 log.debug(response.getText());
42 }
43
44 WebTable[] tables = response.getTables();
45 assertEquals("Expected one table", 1, tables.length);
46
47 assertEquals("Header from resource is not valid.", "foo bundle", tables[0].getCellAsText(0, 0));
48 assertEquals("Header from resource is not valid.", "baz bundle", tables[0].getCellAsText(0, 1));
49 assertEquals("Header from resource is not valid.", "camel bundle", tables[0].getCellAsText(0, 2));
50 assertEquals("Missing resource should generate the ???missing??? header.", "???missing???", tables[0]
51 .getCellAsText(0, 3));
52
53 }
54 }