Source Code Cross Referenced for AssertTest.java in  » Testing » abbot-1.0.1 » abbot » script » 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 » abbot 1.0.1 » abbot.script 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package abbot.script;
002:
003:        import java.awt.*;
004:
005:        import javax.swing.JLabel;
006:        import javax.swing.JTree;
007:
008:        import abbot.AssertionFailedError;
009:        import junit.extensions.abbot.*;
010:
011:        public class AssertTest extends ResolverFixture {
012:
013:            public void testAssertTreePath() throws Throwable {
014:                JTree tree = new JTree();
015:                tree.setSelectionInterval(1, 1);
016:                showFrame(tree);
017:                ComponentReference ref = getResolver().addComponent(tree);
018:                Assert step = new Assert(getResolver(), null,
019:                        "getSelectionPath", ref.getID(), "[JTree, colors]",
020:                        false);
021:                step.runStep();
022:            }
023:
024:            public void testAssertNullValue() throws Throwable {
025:                JLabel label = new JLabel(getName());
026:                Frame frame = showFrame(label);
027:                ComponentReference ref1 = getResolver().addComponent(label);
028:                ComponentReference ref2 = getResolver().addComponent(frame);
029:                Assert step1 = new Assert(getResolver(),
030:                        "label.getName() == null", "getName", ref1.getID(),
031:                        ArgumentParser.NULL, false);
032:                step1.runStep();
033:                label.setName("my label");
034:                try {
035:                    step1.runStep();
036:                    fail("test getName() == null should fail if name is not null");
037:                } catch (AssertionFailedError e) {
038:                }
039:
040:                Assert step2 = new Assert(getResolver(),
041:                        "frame.getName() != null", "getName", ref2.getID(),
042:                        ArgumentParser.NULL, true);
043:                step2.runStep();
044:                frame.setName(null);
045:                try {
046:                    step2.runStep();
047:                    fail("test getName() != null should fail if name is null");
048:                } catch (AssertionFailedError e) {
049:                }
050:
051:            }
052:
053:            /** Verify expressions are always reduced to a canonical boolean form. */
054:            public void testCanonicalBooleans() {
055:                String[] args = {};
056:                Assert step = new Assert(getResolver(), null, "isSomething",
057:                        args, Component.class, "true", false);
058:                assertEquals("Should expect 'true'", "true", step
059:                        .getExpectedResult());
060:                assertTrue("Should not be inverted", !step.isInverted());
061:
062:                step = new Assert(getResolver(), null, "isSomething", args,
063:                        Component.class, "true", true);
064:                assertEquals("Should expect 'true'", "true", step
065:                        .getExpectedResult());
066:                assertTrue("Should be inverted", step.isInverted());
067:
068:                step = new Assert(getResolver(), null, "isSomething", args,
069:                        Component.class, "false", false);
070:                assertEquals("Should expect 'true'", "true", step
071:                        .getExpectedResult());
072:                assertTrue("Should be inverted", step.isInverted());
073:
074:                step = new Assert(getResolver(), null, "isSomething", args,
075:                        Component.class, "false", true);
076:                assertEquals("Should expect 'true'", "true", step
077:                        .getExpectedResult());
078:                assertTrue("Should not be inverted", !step.isInverted());
079:            }
080:
081:            public void testAssertFrameShowing() throws Throwable {
082:                Frame f = showFrame(new JLabel(getName()));
083:                f.setTitle(getName());
084:                String a1 = "<assert method=\"assertFrameShowing\" args=\""
085:                        + getName() + "\"/>";
086:                Step s1 = Step.createStep(getResolver(), a1);
087:                s1.runStep();
088:            }
089:
090:            public void testExpectedResult() throws Throwable {
091:                Frame f = showFrame(new JLabel(getName()));
092:                f.setName(getName());
093:                ComponentReference ref = getResolver().addComponent(f);
094:                Color c = f.getBackground();
095:                String expected = c.toString();
096:                Assert s = new Assert(getResolver(), null, "getBackground", ref
097:                        .getID(), expected, false);
098:                assertEquals("Wrong expected result", expected, s
099:                        .getExpectedResult());
100:                s.runStep();
101:            }
102:
103:            /** Create the assert step without having its class loading context. */
104:            public void testCreateWithNoContext() throws Throwable {
105:                new Assert(getResolver(), getName(), "unresolvedMethod",
106:                        "someComponent", "true", false) {
107:                    protected void setScriptError(Throwable thrown) {
108:                        fail("Assert should load without error");
109:                    }
110:                };
111:            }
112:
113:            public AssertTest(String name) {
114:                super (name);
115:            }
116:
117:            public static void main(String[] args) {
118:                TestHelper.runTests(args, AssertTest.class);
119:            }
120:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.