Source Code Cross Referenced for JavaMakerIUTest.java in  » Test-Coverage » GroboUtils » net » sourceforge » groboutils » uicapture » v1 » javamaker » 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 » Test Coverage » GroboUtils » net.sourceforge.groboutils.uicapture.v1.javamaker 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)JavaMakerIUTest.java
003:         *
004:         * Copyright (C) 2002-2003 Matt Albrecht
005:         * groboclown@users.sourceforge.net
006:         * http://groboutils.sourceforge.net
007:         *
008:         *  Permission is hereby granted, free of charge, to any person obtaining a
009:         *  copy of this software and associated documentation files (the "Software"),
010:         *  to deal in the Software without restriction, including without limitation
011:         *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
012:         *  and/or sell copies of the Software, and to permit persons to whom the 
013:         *  Software is furnished to do so, subject to the following conditions:
014:         *
015:         *  The above copyright notice and this permission notice shall be included in 
016:         *  all copies or substantial portions of the Software. 
017:         *
018:         *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
019:         *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
020:         *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL 
021:         *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
022:         *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
023:         *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
024:         *  DEALINGS IN THE SOFTWARE.
025:         */
026:
027:        package net.sourceforge.groboutils.uicapture.v1.javamaker;
028:
029:        import java.io.File;
030:        import java.io.Writer;
031:        import java.io.StringWriter;
032:        import java.io.IOException;
033:
034:        import net.sourceforge.groboutils.autodoc.v1.AutoDoc;
035:        import junit.framework.Test;
036:        import junit.framework.TestCase;
037:        import junit.framework.TestSuite;
038:
039:        /**
040:         * Tests the JavaMaker class.
041:         *
042:         * @author    Matt Albrecht <a href="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
043:         * @since     Jan 6, 2002
044:         * @version   $Date: 2003/02/10 22:52:34 $
045:         */
046:        public class JavaMakerIUTest extends TestCase {
047:            //-------------------------------------------------------------------------
048:            // Standard JUnit Class-specific declarations
049:
050:            private static final Class THIS_CLASS = JavaMakerIUTest.class;
051:            private static final AutoDoc DOC = new AutoDoc(THIS_CLASS);
052:
053:            public JavaMakerIUTest(String name) {
054:                super (name);
055:            }
056:
057:            //-------------------------------------------------------------------------
058:            // Tests
059:
060:            public void testInstantiation() throws IOException {
061:                try {
062:                    new JavaMaker((File) null, null, null);
063:                    fail("Should throw IAE");
064:                } catch (IllegalArgumentException iae) {
065:                    // do nothing
066:                }
067:                try {
068:                    new JavaMaker((Writer) null, null, null);
069:                    fail("Should throw IAE");
070:                } catch (IllegalArgumentException iae) {
071:                    // do nothing
072:                }
073:                File f = new File("a");
074:                try {
075:                    new JavaMaker(f, "b", "c");
076:                } finally {
077:                    if (f.exists()) {
078:                        f.delete();
079:                    }
080:                }
081:            }
082:
083:            public void testCreatesFile() throws IOException {
084:                File f = File.createTempFile("Script", ".java");
085:                try {
086:                    if (f.exists()) {
087:                        f.delete();
088:                    }
089:                    assertTrue(
090:                            "Generated a temporary file.  It should not already exist.",
091:                            !f.exists());
092:
093:                    JavaMaker jsm = new JavaMaker(f, "a", "b");
094:
095:                    jsm.start();
096:                    jsm.end();
097:
098:                    assertTrue("ScriptMaker should have created temp file.", f
099:                            .exists());
100:                } finally {
101:                    if (f.exists()) {
102:                        f.delete();
103:                    }
104:                }
105:            }
106:
107:            public void testCreatesString() {
108:                StringWriter sw = new StringWriter();
109:                JavaMaker jsm = new JavaMaker(sw, "a", "b");
110:
111:                jsm.start();
112:                jsm.end();
113:
114:                String output = sw.toString();
115:                assertTrue(
116:                        "ScriptMaker should have created a non-empty string.",
117:                        output.length() > 0);
118:            }
119:
120:            public void testIllegalOrderEnd() {
121:                StringWriter sw = new StringWriter();
122:                JavaMaker jsm = new JavaMaker(sw, "a", "b");
123:
124:                try {
125:                    jsm.end();
126:                    fail("end should have thrown an IllegalStateException.");
127:                } catch (IllegalStateException e) {
128:                    // should have generated this exception
129:                }
130:            }
131:
132:            public void testIllegalOrderDelay() {
133:                StringWriter sw = new StringWriter();
134:                JavaMaker jsm = new JavaMaker(sw, "a", "b");
135:
136:                try {
137:                    jsm.generateDelay(10);
138:                    fail("generateDelay should have thrown an IllegalStateException.");
139:                } catch (IllegalStateException e) {
140:                    // should have generated this exception
141:                }
142:            }
143:
144:            public void testIllegalOrderWheel() {
145:                StringWriter sw = new StringWriter();
146:                JavaMaker jsm = new JavaMaker(sw, "a", "b");
147:
148:                try {
149:                    jsm.generateMoveMouseWheel(10);
150:                    fail("generateMoveMouseWheel should have thrown an IllegalStateException.");
151:                } catch (IllegalStateException e) {
152:                    // should have generated this exception
153:                }
154:            }
155:
156:            public void testIllegalOrderMove() {
157:                StringWriter sw = new StringWriter();
158:                JavaMaker jsm = new JavaMaker(sw, "a", "b");
159:
160:                try {
161:                    jsm.generateMoveMouse(10, 10);
162:                    fail("generateMoveMouse should have thrown an IllegalStateException.");
163:                } catch (IllegalStateException e) {
164:                    // should have generated this exception
165:                }
166:            }
167:
168:            public void testIllegalOrderMPress() {
169:                StringWriter sw = new StringWriter();
170:                JavaMaker jsm = new JavaMaker(sw, "a", "b");
171:
172:                try {
173:                    jsm.generatePressMouse(10);
174:                    fail("generatePressMouse should have thrown an IllegalStateException.");
175:                } catch (IllegalStateException e) {
176:                    // should have generated this exception
177:                }
178:            }
179:
180:            public void testIllegalOrderMRelease() {
181:                StringWriter sw = new StringWriter();
182:                JavaMaker jsm = new JavaMaker(sw, "a", "b");
183:
184:                try {
185:                    jsm.generateReleaseMouse(10);
186:                    fail("generateReleaseMouse should have thrown an IllegalStateException.");
187:                } catch (IllegalStateException e) {
188:                    // should have generated this exception
189:                }
190:            }
191:
192:            public void testIllegalOrderKPress() {
193:                StringWriter sw = new StringWriter();
194:                JavaMaker jsm = new JavaMaker(sw, "a", "b");
195:
196:                try {
197:                    jsm.generatePressKey(10);
198:                    fail("generatePressKey should have thrown an IllegalStateException.");
199:                } catch (IllegalStateException e) {
200:                    // should have generated this exception
201:                }
202:            }
203:
204:            public void testIllegalOrderKRelease() {
205:                StringWriter sw = new StringWriter();
206:                JavaMaker jsm = new JavaMaker(sw, "a", "b");
207:
208:                try {
209:                    jsm.generateReleaseKey(10);
210:                    fail("generateReleaseKey should have thrown an IllegalStateException.");
211:                } catch (IllegalStateException e) {
212:                    // should have generated this exception
213:                }
214:            }
215:
216:            public void testIllegalOrderScreen() {
217:                StringWriter sw = new StringWriter();
218:                JavaMaker jsm = new JavaMaker(sw, "a", "b");
219:
220:                try {
221:                    jsm.generateScreenCapture(null, 10, 10, 10, 10);
222:                    fail("generateScreenCapture should have thrown an IllegalStateException.");
223:                } catch (IllegalStateException e) {
224:                    // should have generated this exception
225:                }
226:            }
227:
228:            public void testIllegalOrderStart() {
229:                StringWriter sw = new StringWriter();
230:                JavaMaker jsm = new JavaMaker(sw, "a", "b");
231:
232:                jsm.start();
233:                try {
234:                    jsm.start();
235:                    fail("start should have thrown an IllegalStateException.");
236:                } catch (IllegalStateException e) {
237:                    // should have generated this exception
238:                } finally {
239:                    jsm.end();
240:                }
241:            }
242:
243:            //-------------------------------------------------------------------------
244:            // Standard JUnit declarations
245:
246:            public static Test suite() {
247:                TestSuite suite = new TestSuite(THIS_CLASS);
248:
249:                return suite;
250:            }
251:
252:            public static void main(String[] args) {
253:                String[] name = { THIS_CLASS.getName() };
254:
255:                // junit.textui.TestRunner.main( name );
256:                // junit.swingui.TestRunner.main( name );
257:
258:                junit.textui.TestRunner.main(name);
259:            }
260:
261:            /**
262:             * 
263:             * @exception Exception thrown under any exceptional condition.
264:             */
265:            protected void setUp() throws Exception {
266:                super .setUp();
267:
268:                // set ourself up
269:            }
270:
271:            /**
272:             * 
273:             * @exception Exception thrown under any exceptional condition.
274:             */
275:            protected void tearDown() throws Exception {
276:                // tear ourself down
277:
278:                super.tearDown();
279:            }
280:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.