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


001:        package org.acm.seguin.refactor.type;
002:
003:        import java.io.File;
004:        import org.acm.seguin.io.FileCopy;
005:        import org.acm.seguin.summary.SummaryTraversal;
006:        import org.acm.seguin.junit.FileCompare;
007:        import org.acm.seguin.junit.DirSourceTestCase;
008:        import org.acm.seguin.refactor.RefactoringException;
009:
010:        /**
011:         *  Unit tests for the remove empty class refactoring.
012:         *
013:         *@author    Chris Seguin
014:         */
015:        public class TestRemoveEmptyClassRefactoring extends DirSourceTestCase {
016:            private File cleanDir;
017:            private File impDest;
018:            private File absDest;
019:
020:            /**
021:             *  Constructor for the TestRemoveAbstractParent object
022:             *
023:             *@param  name  Description of Parameter
024:             */
025:            public TestRemoveEmptyClassRefactoring(String name) {
026:                super (name);
027:            }
028:
029:            /**
030:             *  A unit test for JUnit
031:             *
032:             *@exception  RefactoringException  Description of Exception
033:             */
034:            public void test1() throws RefactoringException {
035:                //  Setup
036:                (new FileCopy(new File(cleanDir, "ChildRapOne.java"), new File(
037:                        absDest, "ChildRapOne.java"), false)).run();
038:
039:                (new FileCopy(new File(cleanDir, "RapTestOne.java"), new File(
040:                        absDest, "RapTestOne.java"), false)).run();
041:
042:                (new FileCopy(new File(cleanDir, "ParentRapOne.java"),
043:                        new File(absDest, "ParentRapOne.java"), false)).run();
044:
045:                (new FileCopy(new File(cleanDir, "AccessWrap.java"), new File(
046:                        impDest, "AccessWrap.java"), false)).run();
047:
048:                (new SummaryTraversal(root)).run();
049:                RemoveEmptyClassRefactoring rap = new RemoveEmptyClassRefactoring();
050:                rap.setClass("abstracter", "RapTestOne");
051:                rap.run();
052:
053:                //  Check things out
054:                File check = new File(this .check + "\\ut1\\step16");
055:
056:                FileCompare.assertEquals("ChildRapOne is incorrect", new File(
057:                        check, "ChildRapOne.java"), new File(absDest,
058:                        "ChildRapOne.java"));
059:                FileCompare.assertEquals("ParentRapOne is incorrect", new File(
060:                        check, "ParentRapOne.java"), new File(absDest,
061:                        "ParentRapOne.java"));
062:                FileCompare.assertEquals("AccessWrap is incorrect", new File(
063:                        check, "AccessWrap.java"), new File(impDest,
064:                        "AccessWrap.java"));
065:                assertTrue("RapTestOne still exists", !(new File(absDest,
066:                        "RapTestOne.java")).exists());
067:
068:                //  Tear down
069:                (new File(absDest, "ChildRapOne.java")).delete();
070:                (new File(absDest, "ParentRapOne.java")).delete();
071:                (new File(impDest, "AccessWrap.java")).delete();
072:            }
073:
074:            /**
075:             *  A unit test for JUnit
076:             *
077:             *@exception  RefactoringException  Description of Exception
078:             */
079:            public void test2() throws RefactoringException {
080:                (new FileCopy(new File(cleanDir, "ChildRapTwo.java"), new File(
081:                        absDest, "ChildRapTwo.java"), false)).run();
082:
083:                (new FileCopy(new File(cleanDir, "RapTestTwo.java"), new File(
084:                        absDest, "RapTestTwo.java"), false)).run();
085:
086:                (new FileCopy(new File(cleanDir, "AccessWrap.java"), new File(
087:                        impDest, "AccessWrap.java"), false)).run();
088:
089:                (new SummaryTraversal(root)).run();
090:                RemoveEmptyClassRefactoring rap = new RemoveEmptyClassRefactoring();
091:                rap.setClass("abstracter", "RapTestTwo");
092:                rap.run();
093:
094:                //  Check things out
095:                File check = new File(this .check + "\\ut1\\step17");
096:                FileCompare.assertEquals("ChildRapTwo is incorrect", new File(
097:                        check, "ChildRapTwo.java"), new File(absDest,
098:                        "ChildRapTwo.java"));
099:                FileCompare.assertEquals("AccessWrap is incorrect", new File(
100:                        check, "AccessWrap.java"), new File(impDest,
101:                        "AccessWrap.java"));
102:                assertTrue("RapTestTwo still exists", !(new File(absDest,
103:                        "RapTestTwo.java")).exists());
104:
105:                //  Tear down
106:                (new File(absDest, "ChildRapTwo.java")).delete();
107:                (new File(impDest, "AccessWrap.java")).delete();
108:            }
109:
110:            /**
111:             *  A unit test for JUnit
112:             *
113:             *@exception  RefactoringException  Description of Exception
114:             */
115:            public void test3() throws RefactoringException {
116:                (new FileCopy(new File(cleanDir, "ChildRapThree.java"),
117:                        new File(absDest, "ChildRapThree.java"), false)).run();
118:
119:                (new FileCopy(new File(cleanDir, "RapTestThree.java"),
120:                        new File(absDest, "RapTestThree.java"), false)).run();
121:
122:                (new FileCopy(new File(cleanDir, "ParentRapOne.java"),
123:                        new File(absDest, "ParentRapOne.java"), false)).run();
124:
125:                (new FileCopy(new File(cleanDir, "AccessWrap.java"), new File(
126:                        impDest, "AccessWrap.java"), false)).run();
127:
128:                (new SummaryTraversal(root)).run();
129:                RemoveEmptyClassRefactoring rap = new RemoveEmptyClassRefactoring();
130:                rap.setClass("abstracter", "RapTestThree");
131:                try {
132:                    rap.run();
133:                    fail("No refactoring exceptions were thrown");
134:                } catch (RefactoringException re) {
135:                    assertEquals(
136:                            "Incorrect refactoring exception",
137:                            "The RapTestThree class has at least one method or field",
138:                            re.getMessage());
139:                }
140:
141:                //  Check things out
142:                File check = new File(this .check + "\\ut1\\step18");
143:                FileCompare.assertEquals("ChildRapThree is incorrect",
144:                        new File(check, "ChildRapThree.java"), new File(
145:                                absDest, "ChildRapThree.java"));
146:                FileCompare.assertEquals("RapTestThree is incorrect", new File(
147:                        check, "RapTestThree.java"), new File(absDest,
148:                        "RapTestThree.java"));
149:                FileCompare.assertEquals("ParentRapOne is incorrect", new File(
150:                        check, "ParentRapOne.java"), new File(absDest,
151:                        "ParentRapOne.java"));
152:                FileCompare.assertEquals("AccessWrap is incorrect", new File(
153:                        check, "AccessWrap.java"), new File(impDest,
154:                        "AccessWrap.java"));
155:
156:                //  Tear down
157:                (new File(absDest, "ChildRapThree.java")).delete();
158:                (new File(absDest, "RapTestThree.java")).delete();
159:                (new File(absDest, "ParentRapOne.java")).delete();
160:                (new File(impDest, "AccessWrap.java")).delete();
161:            }
162:
163:            /**
164:             *  A unit test for JUnit
165:             *
166:             *@exception  RefactoringException  Description of Exception
167:             */
168:            public void test4() throws RefactoringException {
169:                (new FileCopy(new File(cleanDir, "ChildRapFour.java"),
170:                        new File(absDest, "ChildRapFour.java"), false)).run();
171:
172:                (new FileCopy(new File(cleanDir, "ChildRapFourImp.java"),
173:                        new File(absDest, "ChildRapFourImp.java"), false))
174:                        .run();
175:
176:                (new FileCopy(new File(cleanDir, "RapTestFour.java"), new File(
177:                        absDest, "RapTestFour.java"), false)).run();
178:
179:                (new FileCopy(new File(cleanDir, "ParentRapFour.java"),
180:                        new File(impDest, "ParentRapFour.java"), false)).run();
181:
182:                (new FileCopy(new File(cleanDir, "AccessWrap.java"), new File(
183:                        impDest, "AccessWrap.java"), false)).run();
184:
185:                File renDir = new File(root, "ren");
186:                (new FileCopy(new File(cleanDir, "OtherPackageRapFour.java"),
187:                        new File(renDir, "OtherPackageRapFour.java"), false))
188:                        .run();
189:
190:                (new SummaryTraversal(root)).run();
191:                RemoveEmptyClassRefactoring rap = new RemoveEmptyClassRefactoring();
192:                rap.setClass("abstracter", "RapTestFour");
193:                rap.run();
194:
195:                //  Check things out
196:                File check = new File(this .check + "\\ut1\\step19");
197:
198:                FileCompare.assertEquals("ChildRapFour is incorrect", new File(
199:                        check, "ChildRapFour.java"), new File(absDest,
200:                        "ChildRapFour.java"));
201:                FileCompare.assertEquals("ParentRapFour is incorrect",
202:                        new File(check, "ParentRapFour.java"), new File(
203:                                impDest, "ParentRapFour.java"));
204:                FileCompare.assertEquals("AccessWrap is incorrect", new File(
205:                        check, "AccessWrap.java"), new File(impDest,
206:                        "AccessWrap.java"));
207:                FileCompare.assertEquals("OtherPackageRapFour is incorrect",
208:                        new File(check, "OtherPackageRapFour.java"), new File(
209:                                renDir, "OtherPackageRapFour.java"));
210:                FileCompare.assertEquals("ChildRapFourImp is incorrect",
211:                        new File(check, "ChildRapFourImp.java"), new File(
212:                                absDest, "ChildRapFourImp.java"));
213:                assertTrue("RapTestFour still exists", !(new File(absDest,
214:                        "RapTestFour.java")).exists());
215:
216:                //  Tear down
217:                (new File(absDest, "ChildRapFour.java")).delete();
218:                (new File(absDest, "ParentRapFour.java")).delete();
219:                (new File(impDest, "AccessWrap.java")).delete();
220:                (new File(renDir, "OtherPackageRapFour.java")).delete();
221:            }
222:
223:            /**
224:             *  The JUnit setup method
225:             */
226:            protected void setUp() {
227:                cleanDir = new File(this .clean);
228:                impDest = new File(root + "\\imp");
229:                absDest = new File(root + "\\abstracter");
230:            }
231:
232:            /**
233:             *  The teardown method for JUnit
234:             */
235:            protected void tearDown() {
236:            }
237:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.