Source Code Cross Referenced for TestPushDownMethod.java in  » UML » jrefactory » org » acm » seguin » refactor » method » 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 » UML » jrefactory » org.acm.seguin.refactor.method 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.acm.seguin.refactor.method;
002:
003:        import java.io.File;
004:        import org.acm.seguin.summary.SummaryTraversal;
005:        import org.acm.seguin.io.FileCopy;
006:        import org.acm.seguin.summary.TypeSummary;
007:        import org.acm.seguin.summary.MethodSummary;
008:        import org.acm.seguin.summary.query.GetTypeSummary;
009:        import org.acm.seguin.summary.query.GetMethodSummary;
010:        import org.acm.seguin.refactor.RefactoringException;
011:        import org.acm.seguin.junit.FileCompare;
012:        import org.acm.seguin.junit.DirSourceTestCase;
013:
014:        /**
015:         *  Functional tests for Push Down method
016:         *
017:         *@author     unknown
018:         *@created    April 5, 2000
019:         */
020:        public class TestPushDownMethod extends DirSourceTestCase {
021:            /**
022:             *  Constructor for the TestPushDownMethod object
023:             *
024:             *@param  name  Description of Parameter
025:             */
026:            public TestPushDownMethod(String name) {
027:                super (name);
028:            }
029:
030:            /**
031:             *  A unit test for JUnit
032:             *
033:             *@exception  RefactoringException  Description of Exception
034:             */
035:            public void test01() throws RefactoringException {
036:                TypeSummary type = GetTypeSummary.query("method", "Parent");
037:                MethodSummary method = GetMethodSummary.query(type, "get");
038:
039:                PushDownMethodRefactoring pdm = new PushDownMethodRefactoring();
040:                pdm.setMethod(method);
041:                pdm.addChild(GetTypeSummary.query("method", "Child"));
042:
043:                pdm.run();
044:
045:                //  Check things out
046:                File check = new File(this .check + "\\ut3\\step3");
047:                File dest = new File(root + "\\method");
048:
049:                FileCompare.assertEquals("Child is incorrect", new File(check,
050:                        "Child.java"), new File(dest, "Child.java"));
051:                FileCompare.assertEquals("Parent is incorrect", new File(check,
052:                        "Parent.java"), new File(dest, "Parent.java"));
053:            }
054:
055:            /**
056:             *  A unit test for JUnit
057:             *
058:             *@exception  RefactoringException  Description of Exception public void
059:             *      test02() throws RefactoringException { TypeSummary type =
060:             *      GetTypeSummary.query("method", "Parent"); MethodSummary method =
061:             *      GetMethodSummary.query(type, "set"); PushDownMethodRefactoring pdm =
062:             *      new PushDownMethodRefactoring(); pdm.setMethod(method); pdm.addChild(GetTypeSummary.query("method",
063:             *      "Child")); pdm.run(); Check things out File checkDir = new File(check + "\\ut3\\step4");
064:	 *      File dest = new File(root + "\\method");
065:	 *      FileCompare.assertEquals("Child is incorrect", new File(checkDir,
066:	 *      "Child.java"), new File(dest, "Child.java"));
067:	 *      FileCompare.assertEquals("Parent is incorrect", new File(checkDir,
068:	 *      "Parent.java"), new File(dest, "Parent.java")); }
069:	 */
070:
071:            /**
072:             *  A unit test for JUnit
073:             *
074:             *  A unit test for JUnit A unit test for JUnit A unit test for JUnit
075:             *
076:             *@exception  RefactoringException  Description of Exception public void
077:             *      test02() throws RefactoringException { TypeSummary type =
078:             *      GetTypeSummary.query("method", "Parent"); MethodSummary method =
079:             *      GetMethodSummary.query(type, "set"); PushDownMethodRefactoring pdm =
080:             *      new PushDownMethodRefactoring(); pdm.setMethod(method); pdm.addChild(GetTypeSummary.query("method",
081:             *      "Child")); pdm.run(); Check things out File check = new File("c:\\chris\\test\\check\\ut3\\step4");
082:	 *      File dest = new File(root + "\\method");
083:	 *      FileCompare.assertEquals("Child is incorrect", new File(check,
084:	 *      "Child.java"), new File(dest, "Child.java"));
085:	 *      FileCompare.assertEquals("Parent is incorrect", new File(check,
086:	 *      "Parent.java"), new File(dest, "Parent.java")); }
087:	 */
088:            public void test03() throws RefactoringException {
089:                TypeSummary type = GetTypeSummary.query("method", "Parent");
090:                MethodSummary method = GetMethodSummary.query(type, "reset");
091:
092:                PushDownMethodRefactoring pdm = new PushDownMethodRefactoring();
093:                pdm.setMethod(method);
094:                pdm.addChild(GetTypeSummary.query("method", "Child"));
095:
096:                pdm.run();
097:
098:                //  Check things out
099:                File check = new File(this .check + "\\ut3\\step5");
100:                File dest = new File(root + "\\method");
101:
102:                FileCompare.assertEquals("Child is incorrect", new File(check,
103:                        "Child.java"), new File(dest, "Child.java"));
104:                FileCompare.assertEquals("Parent is incorrect", new File(check,
105:                        "Parent.java"), new File(dest, "Parent.java"));
106:            }
107:
108:            /**
109:             *  A unit test for JUnit
110:             */
111:            public void test04() {
112:                TypeSummary type = GetTypeSummary.query("method", "Parent");
113:                MethodSummary method = GetMethodSummary.query(type, "stopOne");
114:
115:                PushDownMethodRefactoring pdm = new PushDownMethodRefactoring();
116:                pdm.setMethod(method);
117:                pdm.addChild(GetTypeSummary.query("method", "Child"));
118:
119:                boolean exceptionThrown = false;
120:                try {
121:                    pdm.run();
122:                } catch (RefactoringException re) {
123:                    assertEquals(
124:                            "Incorrect message",
125:                            "A method with the same signature (name and parameter types) already exists in the Child class",
126:                            re.getMessage());
127:                    exceptionThrown = true;
128:                }
129:
130:                assertTrue("No exception thrown", exceptionThrown);
131:            }
132:
133:            /**
134:             *  A unit test for JUnit
135:             */
136:            public void test05() {
137:                TypeSummary type = GetTypeSummary.query("method", "Parent");
138:                MethodSummary method = GetMethodSummary.query(type, "stopTwo");
139:
140:                PushDownMethodRefactoring pdm = new PushDownMethodRefactoring();
141:                pdm.setMethod(method);
142:                pdm.addChild(GetTypeSummary.query("method", "Child"));
143:
144:                boolean exceptionThrown = false;
145:                try {
146:                    pdm.run();
147:                } catch (RefactoringException re) {
148:                    assertEquals(
149:                            "Incorrect message",
150:                            "A method with the conflicting signature (name and parameter types) already exists in the Child class",
151:                            re.getMessage());
152:                    exceptionThrown = true;
153:                }
154:
155:                assertTrue("No exception thrown", exceptionThrown);
156:            }
157:
158:            /**
159:             *  The JUnit setup method
160:             */
161:            protected void setUp() {
162:                File cleanDir = new File(clean);
163:                File destDir = new File(root + "\\method");
164:                destDir.mkdir();
165:
166:                (new FileCopy(new File(cleanDir, "method_Parent.java"),
167:                        new File(destDir, "Parent.java"), false)).run();
168:                (new FileCopy(new File(cleanDir, "method_Child.java"),
169:                        new File(destDir, "Child.java"), false)).run();
170:
171:                (new SummaryTraversal(root)).run();
172:            }
173:
174:            /**
175:             *  The teardown method for JUnit
176:             */
177:            protected void tearDown() {
178:                File destDir = new File(root + "\\method");
179:                (new File(destDir, "Parent.java")).delete();
180:                (new File(destDir, "Child.java")).delete();
181:            }
182:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.