Source Code Cross Referenced for TextBoxForLabelTest.java in  » Testing » UISpec4J » org » uispec4j » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » UISpec4J » org.uispec4j 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.uispec4j;
002:
003:        import org.uispec4j.utils.Functor;
004:        import org.uispec4j.utils.UIComponentFactory;
005:        import org.uispec4j.xml.XmlAssert;
006:
007:        import javax.swing.ImageIcon;
008:        import javax.swing.JLabel;
009:
010:        public class TextBoxForLabelTest extends TextBoxComponentTestCase {
011:            private JLabel jLabel;
012:
013:            protected void setUp() throws Exception {
014:                super .setUp();
015:                jLabel = new JLabel("some text");
016:                jLabel.setName("myLabel");
017:                textBox = new TextBox(jLabel);
018:            }
019:
020:            protected void createTextBox(String text) {
021:                jLabel = new JLabel(text);
022:                textBox = new TextBox(jLabel);
023:            }
024:
025:            public void testGetComponentTypeName() throws Exception {
026:                assertEquals("textBox", UIComponentFactory.createUIComponent(
027:                        new JLabel()).getDescriptionTypeName());
028:            }
029:
030:            public void testGetDescription() throws Exception {
031:                XmlAssert.assertEquivalent("<textBox name='myLabel'/>", textBox
032:                        .getDescription());
033:            }
034:
035:            public void testFactory() throws Exception {
036:                checkFactory(new JLabel(), TextBox.class);
037:            }
038:
039:            public void testAssertTextEquals() throws Exception {
040:                assertTrue(textBox.textEquals("some text"));
041:                checkAssertionFails(textBox.textEquals("unknown"),
042:                        "expected:<unknown> but was:<some text>");
043:            }
044:
045:            public void testAssertTextEqualsWithHtml() throws Exception {
046:                String text = "My name is <b>Bond</b>";
047:                jLabel.setText(text);
048:                assertTrue(textBox.textEquals(text));
049:                assertFalse(textBox
050:                        .textEquals("My name is <b>Bond</b>, James Bond"));
051:            }
052:
053:            public void testAssertTextContains() throws Exception {
054:                jLabel.setText("some text");
055:                assertTrue(textBox.textContains("some"));
056:                checkAssertionFails(textBox.textContains("error"),
057:                        "The component text does not contain 'error' - actual content is: some text");
058:            }
059:
060:            public void testAssertTextDoesNotContain() throws Exception {
061:                jLabel.setText("some text");
062:                assertTrue(textBox.textDoesNotContain("xxx"));
063:                checkAssertionFails(textBox.textDoesNotContain("some"),
064:                        "The component text should not contain 'some' - actual content is: some text");
065:            }
066:
067:            public void testAssertTextIsEditable() throws Exception {
068:                assertFalse(textBox.isEditable());
069:            }
070:
071:            public void testAssertEmpty() throws Exception {
072:                jLabel.setText("");
073:                assertTrue(textBox.textIsEmpty());
074:                jLabel.setText("a");
075:                checkAssertionFails(textBox.textIsEmpty(),
076:                        "Text should be empty but contains: a");
077:            }
078:
079:            public void testSetTextIsNotSupported() throws Exception {
080:                checkAssertionFailedError(new Functor() {
081:                    public void run() throws Exception {
082:                        textBox.setText("text");
083:                    }
084:                }, "The text box is not editable");
085:                assertEquals("some text", textBox.getText());
086:            }
087:
088:            public void testInsertTextIsNotSupported() throws Exception {
089:                checkAssertionFailedError(new Functor() {
090:                    public void run() throws Exception {
091:                        textBox.insertText("text", 0);
092:                    }
093:                }, "The text box is not editable");
094:                assertEquals("some text", textBox.getText());
095:            }
096:
097:            public void testGetText() throws Exception {
098:                assertEquals("some text", textBox.getText());
099:                jLabel.setText("new text");
100:                assertEquals("new text", textBox.getText());
101:            }
102:
103:            public void testClickOnHyperlinkIsNotSupported() throws Exception {
104:                checkAssertionFailedError(new Functor() {
105:                    public void run() throws Exception {
106:                        textBox.clickOnHyperlink("text");
107:                    }
108:                }, "This component does not support hyperlinks.");
109:                checkAssertionFailedError(new Functor() {
110:                    public void run() throws Exception {
111:                        textBox.triggerClickOnHyperlink("text").run();
112:                    }
113:                }, "This component does not support hyperlinks.");
114:            }
115:
116:            public void testAssertIconEquals() throws Exception {
117:                ImageIcon icon1 = new ImageIcon();
118:                jLabel.setIcon(icon1);
119:                assertTrue(textBox.iconEquals(icon1));
120:                checkAssertionFailedError(new Functor() {
121:                    public void run() throws Exception {
122:                        ImageIcon icon2 = new ImageIcon();
123:                        assertTrue(textBox.iconEquals(icon2));
124:                    }
125:                });
126:            }
127:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.