01: /*
02: * Copyright (c) 2002-2006 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.webwork.views.jsp.ui;
06:
07: import com.opensymphony.webwork.views.jsp.AbstractUITagTest;
08:
09: /**
10: * Unit test for {@link DebugTag}.
11: *
12: * @author Claus Ibsen
13: */
14: public class DebugTagTest extends AbstractUITagTest {
15:
16: private DebugTag tag;
17:
18: public void testDebug() throws Exception {
19: tag.doStartTag();
20: tag.doEndTag();
21:
22: assertNotNull(writer.toString());
23: assertTrue("There should be at alot of debug data", writer
24: .toString().length() > 5000);
25: }
26:
27: public void testDebug2() throws Exception {
28: MyPerson person = new MyPerson("Santa Claus", "rudolph");
29: stack.push(person);
30: tag.doStartTag();
31: tag.doEndTag();
32:
33: assertNotNull(writer.toString());
34: assertTrue("There should be at alot of debug data", writer
35: .toString().length() > 5000);
36: assertTrue("MyPerson should be in stack and in debug output",
37: writer.toString().indexOf("MyPerson") > -1);
38: }
39:
40: protected void setUp() throws Exception {
41: super .setUp();
42: tag = new DebugTag();
43: tag.setPageContext(pageContext);
44: }
45:
46: protected void tearDown() throws Exception {
47: super .tearDown();
48: }
49:
50: private class MyPerson {
51: private String username;
52: private String password;
53:
54: public MyPerson(String username, String password) {
55: this .username = username;
56: this .password = password;
57: }
58:
59: public String toString() {
60: return "MyPerson{" + "username='" + username + '\''
61: + ", password='" + password + '\'' + '}';
62: }
63: }
64:
65: }
|