Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move tests cleanup

  • Loading branch information...
commit 2b6a35077f8dc51b2a568c1d5b2d3f1d65dc2df0 1 parent d18189c
Pavel Fatin pavelfatin authored
Showing with 0 additions and 2,762 deletions.
  1. +0 −115 test/org/jetbrains/plugins/scala/lang/refactoring/CopyClassTest.java
  2. +0 −95 test/org/jetbrains/plugins/scala/lang/refactoring/CopyTest.java
  3. +0 −56 test/org/jetbrains/plugins/scala/lang/refactoring/DndMoveTest.java
  4. +0 −11 test/org/jetbrains/plugins/scala/lang/refactoring/JavaTestUtil.java
  5. +0 −84 test/org/jetbrains/plugins/scala/lang/refactoring/MoveClassAndFileTest.java
  6. +0 −125 test/org/jetbrains/plugins/scala/lang/refactoring/MoveClassTest.java
  7. +0 −154 test/org/jetbrains/plugins/scala/lang/refactoring/MoveClassToInnerTest.java
  8. +0 −156 test/org/jetbrains/plugins/scala/lang/refactoring/MoveInnerTest.java
  9. +0 −178 test/org/jetbrains/plugins/scala/lang/refactoring/MovePackageAsDirectoryTest.java
  10. +0 −91 test/org/jetbrains/plugins/scala/lang/refactoring/MovePackageMultirootTest.java
  11. +0 −69 test/org/jetbrains/plugins/scala/lang/refactoring/MovePackageTest.java
  12. +0 −26 test/org/jetbrains/plugins/scala/lang/refactoring/RefactoringTestCase.java
  13. +0 −107 test/org/jetbrains/plugins/scala/lang/refactoring/RenameClassTest.java
  14. 0  testdata/refactoring/copy/multifile/copyAvailable/pack1/p1.txt
  15. 0  testdata/refactoring/copy/multifile/copyAvailable/pack2/pack2.txt
  16. +0 −2  testdata/refactoring/copy/multifile/javaAndTxt/pack1/Class1.java
  17. 0  testdata/refactoring/copy/multifile/javaAndTxt/pack1/p1.txt
  18. +0 −2  testdata/refactoring/copy/multifile/javaAndTxt/pack2/Class2.java
  19. 0  testdata/refactoring/copy/multifile/javaAndTxt/pack2/p2.txt
  20. +0 −6 testdata/refactoring/copy/multifile/multipleClasses/pack1/Klass.java
  21. +0 −6 testdata/refactoring/copy/multifile/multipleClasses/pack2/Klass.expected.java
  22. 0  testdata/refactoring/copy/multifile/multipleFiles/from/1.txt
  23. 0  testdata/refactoring/copy/multifile/multipleFiles/from/2.txt
  24. 0  testdata/refactoring/copy/multifile/multipleFiles/to/empty.txt
  25. +0 −592 testdata/refactoring/copyClass/libraryClass/Bar.expected.java
  26. +0 −7 testdata/refactoring/copyClass/multifile/packageHierarchy/after/p1/S1.java
  27. +0 −7 testdata/refactoring/copyClass/multifile/packageHierarchy/after/p1/S2.java
  28. +0 −2  testdata/refactoring/copyClass/multifile/packageHierarchy/after/p1/p11/S11.java
  29. 0  testdata/refactoring/copyClass/multifile/packageHierarchy/after/p2/empty.txt
  30. +0 −8 testdata/refactoring/copyClass/multifile/packageHierarchy/after/p2/p1/S1.java
  31. +0 −8 testdata/refactoring/copyClass/multifile/packageHierarchy/after/p2/p1/S2.java
  32. +0 −2  testdata/refactoring/copyClass/multifile/packageHierarchy/after/p2/p1/p11/S11.java
  33. +0 −7 testdata/refactoring/copyClass/multifile/packageHierarchy/before/p1/S1.java
  34. +0 −7 testdata/refactoring/copyClass/multifile/packageHierarchy/before/p1/S2.java
  35. +0 −2  testdata/refactoring/copyClass/multifile/packageHierarchy/before/p1/p11/S11.java
  36. 0  testdata/refactoring/copyClass/multifile/packageHierarchy/before/p2/empty.txt
  37. +0 −4 testdata/refactoring/copyClass/multifile/packageLocalClasses/after/p1/S1.java
  38. +0 −4 testdata/refactoring/copyClass/multifile/packageLocalClasses/after/p1/S2.java
  39. 0  testdata/refactoring/copyClass/multifile/packageLocalClasses/after/p1/empty.txt
  40. +0 −5 testdata/refactoring/copyClass/multifile/packageLocalClasses/after/p2/S1.java
  41. +0 −5 testdata/refactoring/copyClass/multifile/packageLocalClasses/after/p2/S2.java
  42. 0  testdata/refactoring/copyClass/multifile/packageLocalClasses/after/p2/empty.txt
  43. +0 −4 testdata/refactoring/copyClass/multifile/packageLocalClasses/before/p1/S1.java
  44. +0 −4 testdata/refactoring/copyClass/multifile/packageLocalClasses/before/p1/S2.java
  45. 0  testdata/refactoring/copyClass/multifile/packageLocalClasses/before/p1/empty.txt
  46. 0  testdata/refactoring/copyClass/multifile/packageLocalClasses/before/p2/empty.txt
  47. +0 −7 testdata/refactoring/copyClass/multifile/packageLocalMethods/after/p1/S1.java
  48. +0 −7 testdata/refactoring/copyClass/multifile/packageLocalMethods/after/p1/S2.java
  49. 0  testdata/refactoring/copyClass/multifile/packageLocalMethods/after/p1/empty.txt
  50. +0 −8 testdata/refactoring/copyClass/multifile/packageLocalMethods/after/p2/S1.java
  51. +0 −8 testdata/refactoring/copyClass/multifile/packageLocalMethods/after/p2/S2.java
  52. 0  testdata/refactoring/copyClass/multifile/packageLocalMethods/after/p2/empty.txt
  53. +0 −7 testdata/refactoring/copyClass/multifile/packageLocalMethods/before/p1/S1.java
  54. +0 −7 testdata/refactoring/copyClass/multifile/packageLocalMethods/before/p1/S2.java
  55. 0  testdata/refactoring/copyClass/multifile/packageLocalMethods/before/p1/empty.txt
  56. 0  testdata/refactoring/copyClass/multifile/packageLocalMethods/before/p2/empty.txt
  57. +0 −7 testdata/refactoring/copyClass/multifile/packageOneLevelHierarchy/after/p1/S1.java
  58. +0 −7 testdata/refactoring/copyClass/multifile/packageOneLevelHierarchy/after/p1/S2.java
  59. 0  testdata/refactoring/copyClass/multifile/packageOneLevelHierarchy/after/p2/empty.txt
  60. +0 −8 testdata/refactoring/copyClass/multifile/packageOneLevelHierarchy/after/p2/p1/S1.java
  61. +0 −8 testdata/refactoring/copyClass/multifile/packageOneLevelHierarchy/after/p2/p1/S2.java
  62. +0 −7 testdata/refactoring/copyClass/multifile/packageOneLevelHierarchy/before/p1/S1.java
  63. +0 −7 testdata/refactoring/copyClass/multifile/packageOneLevelHierarchy/before/p1/S2.java
  64. 0  testdata/refactoring/copyClass/multifile/packageOneLevelHierarchy/before/p2/empty.txt
  65. +0 −9 testdata/refactoring/copyClass/replaceAllOccurrences/Bar.expected.java
  66. +0 −9 testdata/refactoring/copyClass/replaceAllOccurrences/Foo.java
  67. +0 −2  testdata/refactoring/dndMove/publicJavaClass/d/MyClass.java
  68. +0 −5 testdata/refactoring/dndMove/secondJavaClass/d/MyClass.java
  69. +0 −9 testdata/refactoring/moveClass/classAndSecondary/after/pack1/User.java
  70. +0 −11 testdata/refactoring/moveClass/classAndSecondary/after/pack2/Class1.java
  71. 0  testdata/refactoring/moveClass/classAndSecondary/after/pack2/empty.txt
  72. +0 −11 testdata/refactoring/moveClass/classAndSecondary/before/pack1/Class1.java
  73. +0 −6 testdata/refactoring/moveClass/classAndSecondary/before/pack1/User.java
  74. 0  testdata/refactoring/moveClass/classAndSecondary/before/pack2/empty.txt
  75. +0 −4 testdata/refactoring/moveClass/contextChange1/after/pack1/Class2.scala
  76. 0  testdata/refactoring/moveClass/contextChange1/after/pack1/empty.txt
  77. +0 −7 testdata/refactoring/moveClass/contextChange1/after/pack2/Class1.scala
  78. 0  testdata/refactoring/moveClass/contextChange1/after/pack2/empty.txt
  79. +0 −5 testdata/refactoring/moveClass/contextChange1/before/pack1/Class1.scala
  80. +0 −4 testdata/refactoring/moveClass/contextChange1/before/pack1/Class2.scala
  81. 0  testdata/refactoring/moveClass/contextChange1/before/pack1/empty.txt
  82. 0  testdata/refactoring/moveClass/contextChange1/before/pack2/empty.txt
  83. +0 −4 testdata/refactoring/moveClass/contextChange2/after/pack1/Class2.scala
  84. 0  testdata/refactoring/moveClass/contextChange2/after/pack1/empty.txt
  85. +0 −9 testdata/refactoring/moveClass/contextChange2/after/pack2/Class1.scala
  86. 0  testdata/refactoring/moveClass/contextChange2/after/pack2/empty.txt
  87. +0 −7 testdata/refactoring/moveClass/contextChange2/before/pack1/Class1.scala
  88. +0 −4 testdata/refactoring/moveClass/contextChange2/before/pack1/Class2.scala
  89. 0  testdata/refactoring/moveClass/contextChange2/before/pack1/empty.txt
  90. 0  testdata/refactoring/moveClass/contextChange2/before/pack2/empty.txt
  91. +0 −4 testdata/refactoring/moveClass/contextChangeWithCaseClass/after/pack1/Class2.scala
  92. 0  testdata/refactoring/moveClass/contextChangeWithCaseClass/after/pack1/empty.txt
  93. +0 −7 testdata/refactoring/moveClass/contextChangeWithCaseClass/after/pack2/Class1.scala
  94. 0  testdata/refactoring/moveClass/contextChangeWithCaseClass/after/pack2/empty.txt
  95. +0 −5 testdata/refactoring/moveClass/contextChangeWithCaseClass/before/pack1/Class1.scala
  96. +0 −4 testdata/refactoring/moveClass/contextChangeWithCaseClass/before/pack1/Class2.scala
  97. 0  testdata/refactoring/moveClass/contextChangeWithCaseClass/before/pack1/empty.txt
  98. 0  testdata/refactoring/moveClass/contextChangeWithCaseClass/before/pack2/empty.txt
  99. +0 −4 testdata/refactoring/moveClass/contextChangeWithObject/after/pack1/Class2.scala
  100. 0  testdata/refactoring/moveClass/contextChangeWithObject/after/pack1/empty.txt
  101. +0 −7 testdata/refactoring/moveClass/contextChangeWithObject/after/pack2/Class1.scala
  102. 0  testdata/refactoring/moveClass/contextChangeWithObject/after/pack2/empty.txt
  103. +0 −5 testdata/refactoring/moveClass/contextChangeWithObject/before/pack1/Class1.scala
  104. +0 −4 testdata/refactoring/moveClass/contextChangeWithObject/before/pack1/Class2.scala
  105. 0  testdata/refactoring/moveClass/contextChangeWithObject/before/pack1/empty.txt
  106. 0  testdata/refactoring/moveClass/contextChangeWithObject/before/pack2/empty.txt
  107. +0 −3  testdata/refactoring/moveClass/ideadev27996/after/pack1/X.java
  108. +0 −5 testdata/refactoring/moveClass/ideadev27996/after/pack2/X.java
  109. 0  testdata/refactoring/moveClass/ideadev27996/after/pack2/empty.txt
  110. +0 −6 testdata/refactoring/moveClass/ideadev27996/before/pack1/X.java
  111. 0  testdata/refactoring/moveClass/ideadev27996/before/pack2/empty.txt
  112. +0 −13 testdata/refactoring/moveClass/jsp/after/WEB-INF/TestTEI.java
  113. BIN  testdata/refactoring/moveClass/jsp/after/WEB-INF/classes/TestTEI.class
  114. +0 −13 testdata/refactoring/moveClass/jsp/after/WEB-INF/test.tld
  115. 0  testdata/refactoring/moveClass/jsp/after/pack1/empty.txt
  116. +0 −4 testdata/refactoring/moveClass/jsp/after/pack2/TestClass.java
  117. 0  testdata/refactoring/moveClass/jsp/after/pack2/empty.txt
  118. +0 −7 testdata/refactoring/moveClass/jsp/after/test.jsp
  119. +0 −13 testdata/refactoring/moveClass/jsp/before/WEB-INF/TestTEI.java
  120. BIN  testdata/refactoring/moveClass/jsp/before/WEB-INF/classes/TestTEI.class
  121. +0 −13 testdata/refactoring/moveClass/jsp/before/WEB-INF/test.tld
  122. +0 −4 testdata/refactoring/moveClass/jsp/before/pack1/TestClass.java
  123. 0  testdata/refactoring/moveClass/jsp/before/pack1/empty.txt
  124. 0  testdata/refactoring/moveClass/jsp/before/pack2/empty.txt
  125. +0 −7 testdata/refactoring/moveClass/jsp/before/test.jsp
  126. 0  testdata/refactoring/moveClass/localClass/after/pack1/empty.txt
  127. +0 −9 testdata/refactoring/moveClass/localClass/after/pack2/A.scala
  128. 0  testdata/refactoring/moveClass/localClass/after/pack2/empty.txt
  129. +0 −9 testdata/refactoring/moveClass/localClass/before/pack1/A.scala
  130. 0  testdata/refactoring/moveClass/localClass/before/pack1/empty.txt
  131. 0  testdata/refactoring/moveClass/localClass/before/pack2/empty.txt
  132. 0  testdata/refactoring/moveClass/moveMultiple1/after/pack1/empty.txt
  133. +0 −6 testdata/refactoring/moveClass/moveMultiple1/after/pack2/Class1.scala
  134. +0 −4 testdata/refactoring/moveClass/moveMultiple1/after/pack2/Class2.scala
  135. 0  testdata/refactoring/moveClass/moveMultiple1/after/pack2/empty.txt
  136. +0 −6 testdata/refactoring/moveClass/moveMultiple1/before/pack1/Class1.scala
  137. +0 −4 testdata/refactoring/moveClass/moveMultiple1/before/pack1/Class2.scala
  138. 0  testdata/refactoring/moveClass/moveMultiple1/before/pack1/empty.txt
  139. 0  testdata/refactoring/moveClass/moveMultiple1/before/pack2/empty.txt
  140. 0  testdata/refactoring/moveClass/nonJava/after/pack1/empty.txt
  141. +0 −4 testdata/refactoring/moveClass/nonJava/after/pack2/Class1.java
  142. 0  testdata/refactoring/moveClass/nonJava/after/pack2/empty.txt
  143. +0 −3  testdata/refactoring/moveClass/nonJava/after/qqq.txt
  144. +0 −4 testdata/refactoring/moveClass/nonJava/before/pack1/Class1.java
  145. 0  testdata/refactoring/moveClass/nonJava/before/pack1/empty.txt
  146. 0  testdata/refactoring/moveClass/nonJava/before/pack2/empty.txt
  147. +0 −3  testdata/refactoring/moveClass/nonJava/before/qqq.txt
  148. +0 −1  testdata/refactoring/moveClass/refInPropertiesFile/after/my.properties
  149. +0 −2  testdata/refactoring/moveClass/refInPropertiesFile/after/p/MyClass.java
  150. 0  testdata/refactoring/moveClass/refInPropertiesFile/after/p/empty.txt
  151. 0  testdata/refactoring/moveClass/refInPropertiesFile/after/p1/empty.txt
  152. +0 −1  testdata/refactoring/moveClass/refInPropertiesFile/before/my.properties
  153. 0  testdata/refactoring/moveClass/refInPropertiesFile/before/p/empty.txt
  154. +0 −2  testdata/refactoring/moveClass/refInPropertiesFile/before/p1/MyClass.java
  155. 0  testdata/refactoring/moveClass/refInPropertiesFile/before/p1/empty.txt
  156. +0 −5 testdata/refactoring/moveClass/secondaryClass/after/pack1/Class1.scala
  157. +0 −5 testdata/refactoring/moveClass/secondaryClass/after/pack1/Class2.scala
  158. +0 −6 testdata/refactoring/moveClass/secondaryClass/after/pack1/User.scala
  159. +0 −8 testdata/refactoring/moveClass/secondaryClass/before/pack1/Class1.scala
  160. +0 −6 testdata/refactoring/moveClass/secondaryClass/before/pack1/User.scala
  161. +0 −6 testdata/refactoring/moveClass/stringsAndComments/after/Client.java
  162. 0  testdata/refactoring/moveClass/stringsAndComments/after/pack1/empty.txt
  163. +0 −4 testdata/refactoring/moveClass/stringsAndComments/after/pack2/Class1.java
  164. 0  testdata/refactoring/moveClass/stringsAndComments/after/pack2/empty.txt
  165. +0 −6 testdata/refactoring/moveClass/stringsAndComments/before/Client.java
  166. +0 −4 testdata/refactoring/moveClass/stringsAndComments/before/pack1/Class1.java
  167. 0  testdata/refactoring/moveClass/stringsAndComments/before/pack1/empty.txt
  168. 0  testdata/refactoring/moveClass/stringsAndComments/before/pack2/empty.txt
  169. 0  testdata/refactoring/moveClass/stringsAndComments2/after/pack1/empty.txt
  170. +0 −5 testdata/refactoring/moveClass/stringsAndComments2/after/pack2/AClass.java
  171. 0  testdata/refactoring/moveClass/stringsAndComments2/after/pack2/empty.txt
  172. +0 −5 testdata/refactoring/moveClass/stringsAndComments2/before/pack1/AClass.java
  173. 0  testdata/refactoring/moveClass/stringsAndComments2/before/pack1/empty.txt
  174. 0  testdata/refactoring/moveClass/stringsAndComments2/before/pack2/empty.txt
  175. +0 −5 testdata/refactoring/moveClass/unusedImport/after/p1/F1.java
  176. +0 −3  testdata/refactoring/moveClass/unusedImport/after/p1/F2.java
  177. 0  testdata/refactoring/moveClass/unusedImport/after/p2/empty.txt
  178. +0 −7 testdata/refactoring/moveClass/unusedImport/before/p1/F1.java
  179. +0 −3  testdata/refactoring/moveClass/unusedImport/before/p2/F2.java
  180. 0  testdata/refactoring/moveClass/unusedImport/before/p2/empty.txt
  181. 0  testdata/refactoring/moveClassAndFile/allClassesInFile/after/s/empty.txt
  182. +0 −3  testdata/refactoring/moveClassAndFile/allClassesInFile/after/t/MyClass.java
  183. 0  testdata/refactoring/moveClassAndFile/allClassesInFile/after/t/empty.txt
  184. 0  testdata/refactoring/moveClassAndFile/allClassesInFile/after/t/txt2move.txt
  185. +0 −3  testdata/refactoring/moveClassAndFile/allClassesInFile/before/s/MyClass.java
  186. 0  testdata/refactoring/moveClassAndFile/allClassesInFile/before/s/empty.txt
  187. 0  testdata/refactoring/moveClassAndFile/allClassesInFile/before/s/txt2move.txt
  188. 0  testdata/refactoring/moveClassAndFile/allClassesInFile/before/t/empty.txt
  189. +0 −3  testdata/refactoring/moveClassAndFile/leavePackageLocalClass/after/s/MyLocal.java
  190. 0  testdata/refactoring/moveClassAndFile/leavePackageLocalClass/after/s/empty.txt
  191. +0 −2  testdata/refactoring/moveClassAndFile/leavePackageLocalClass/after/t/MyClass.java
  192. 0  testdata/refactoring/moveClassAndFile/leavePackageLocalClass/after/t/empty.txt
  193. 0  testdata/refactoring/moveClassAndFile/leavePackageLocalClass/after/t/txt2move.txt
  194. +0 −3  testdata/refactoring/moveClassAndFile/leavePackageLocalClass/before/s/MyClass.java
  195. 0  testdata/refactoring/moveClassAndFile/leavePackageLocalClass/before/s/empty.txt
  196. 0  testdata/refactoring/moveClassAndFile/leavePackageLocalClass/before/s/txt2move.txt
  197. 0  testdata/refactoring/moveClassAndFile/leavePackageLocalClass/before/t/empty.txt
  198. +0 −2  testdata/refactoring/moveClassAndFile/onlyPackageLocalClass/after/s/MyClass.java
  199. 0  testdata/refactoring/moveClassAndFile/onlyPackageLocalClass/after/s/empty.txt
  200. +0 −3  testdata/refactoring/moveClassAndFile/onlyPackageLocalClass/after/t/MyLocal.java
  201. 0  testdata/refactoring/moveClassAndFile/onlyPackageLocalClass/after/t/empty.txt
  202. 0  testdata/refactoring/moveClassAndFile/onlyPackageLocalClass/after/t/txt2move.txt
  203. +0 −3  testdata/refactoring/moveClassAndFile/onlyPackageLocalClass/before/s/MyClass.java
  204. 0  testdata/refactoring/moveClassAndFile/onlyPackageLocalClass/before/s/empty.txt
  205. 0  testdata/refactoring/moveClassAndFile/onlyPackageLocalClass/before/s/txt2move.txt
  206. 0  testdata/refactoring/moveClassAndFile/onlyPackageLocalClass/before/t/empty.txt
  207. +0 −4 testdata/refactoring/moveClassToInner/contextChange1/after/pack1/Class2.java
  208. 0  testdata/refactoring/moveClassToInner/contextChange1/after/pack1/empty.txt
  209. +0 −9 testdata/refactoring/moveClassToInner/contextChange1/after/pack2/A.java
  210. 0  testdata/refactoring/moveClassToInner/contextChange1/after/pack2/empty.txt
  211. +0 −5 testdata/refactoring/moveClassToInner/contextChange1/before/pack1/Class1.java
  212. +0 −4 testdata/refactoring/moveClassToInner/contextChange1/before/pack1/Class2.java
  213. 0  testdata/refactoring/moveClassToInner/contextChange1/before/pack1/empty.txt
  214. +0 −4 testdata/refactoring/moveClassToInner/contextChange1/before/pack2/A.java
  215. 0  testdata/refactoring/moveClassToInner/contextChange1/before/pack2/empty.txt
  216. +0 −4 testdata/refactoring/moveClassToInner/contextChange2/after/pack1/Class2.java
  217. 0  testdata/refactoring/moveClassToInner/contextChange2/after/pack1/empty.txt
  218. +0 −11 testdata/refactoring/moveClassToInner/contextChange2/after/pack2/A.java
  219. 0  testdata/refactoring/moveClassToInner/contextChange2/after/pack2/empty.txt
  220. +0 −7 testdata/refactoring/moveClassToInner/contextChange2/before/pack1/Class1.java
  221. +0 −4 testdata/refactoring/moveClassToInner/contextChange2/before/pack1/Class2.java
  222. 0  testdata/refactoring/moveClassToInner/contextChange2/before/pack1/empty.txt
  223. +0 −4 testdata/refactoring/moveClassToInner/contextChange2/before/pack2/A.java
  224. 0  testdata/refactoring/moveClassToInner/contextChange2/before/pack2/empty.txt
  225. +0 −4 testdata/refactoring/moveClassToInner/duplicateInner/before/pack1/Class1.java
  226. +0 −6 testdata/refactoring/moveClassToInner/duplicateInner/before/pack2/A.java
  227. 0  testdata/refactoring/moveClassToInner/innerImport/after/pack1/empty.txt
  228. +0 −6 testdata/refactoring/moveClassToInner/innerImport/after/pack2/A.java
  229. 0  testdata/refactoring/moveClassToInner/innerImport/after/pack2/empty.txt
  230. +0 −7 testdata/refactoring/moveClassToInner/innerImport/after/packUser/Class2.java
  231. +0 −4 testdata/refactoring/moveClassToInner/innerImport/before/pack1/Class1.java
  232. 0  testdata/refactoring/moveClassToInner/innerImport/before/pack1/empty.txt
  233. +0 −4 testdata/refactoring/moveClassToInner/innerImport/before/pack2/A.java
  234. 0  testdata/refactoring/moveClassToInner/innerImport/before/pack2/empty.txt
  235. +0 −7 testdata/refactoring/moveClassToInner/innerImport/before/packUser/Class2.java
  236. 0  testdata/refactoring/moveClassToInner/insertInnerClassImport/after/pack1/empty.txt
  237. +0 −6 testdata/refactoring/moveClassToInner/insertInnerClassImport/after/pack2/A.java
  238. 0  testdata/refactoring/moveClassToInner/insertInnerClassImport/after/pack2/empty.txt
  239. +0 −7 testdata/refactoring/moveClassToInner/insertInnerClassImport/after/packUser/Class2.java
  240. +0 −4 testdata/refactoring/moveClassToInner/insertInnerClassImport/before/pack1/Class1.java
  241. 0  testdata/refactoring/moveClassToInner/insertInnerClassImport/before/pack1/empty.txt
  242. +0 −4 testdata/refactoring/moveClassToInner/insertInnerClassImport/before/pack2/A.java
  243. 0  testdata/refactoring/moveClassToInner/insertInnerClassImport/before/pack2/empty.txt
  244. +0 −7 testdata/refactoring/moveClassToInner/insertInnerClassImport/before/packUser/Class2.java
  245. +0 −7 testdata/refactoring/moveClassToInner/locallyUsedPackageLocalToPublicInterface/after/pack1/Usage.java
  246. 0  testdata/refactoring/moveClassToInner/locallyUsedPackageLocalToPublicInterface/after/pack1/empty.txt
  247. +0 −6 testdata/refactoring/moveClassToInner/locallyUsedPackageLocalToPublicInterface/after/pack2/A.java
  248. 0  testdata/refactoring/moveClassToInner/locallyUsedPackageLocalToPublicInterface/after/pack2/empty.txt
  249. +0 −4 testdata/refactoring/moveClassToInner/locallyUsedPackageLocalToPublicInterface/before/pack1/Class1.java
  250. +0 −4 testdata/refactoring/moveClassToInner/locallyUsedPackageLocalToPublicInterface/before/pack1/Usage.java
  251. 0  testdata/refactoring/moveClassToInner/locallyUsedPackageLocalToPublicInterface/before/pack1/empty.txt
  252. +0 −4 testdata/refactoring/moveClassToInner/locallyUsedPackageLocalToPublicInterface/before/pack2/A.java
  253. 0  testdata/refactoring/moveClassToInner/locallyUsedPackageLocalToPublicInterface/before/pack2/empty.txt
  254. +0 −4 testdata/refactoring/moveClassToInner/moveIntoPackageLocalClass/before/pack1/Class1.java
  255. +0 −5 testdata/refactoring/moveClassToInner/moveIntoPackageLocalClass/before/pack1/Class2.java
  256. +0 −4 testdata/refactoring/moveClassToInner/moveIntoPackageLocalClass/before/pack2/A.java
  257. +0 −6 testdata/refactoring/moveClassToInner/moveIntoPrivateInnerClass/before/pack1/A.java
  258. +0 −4 testdata/refactoring/moveClassToInner/moveIntoPrivateInnerClass/before/pack1/Class1.java
  259. +0 −5 testdata/refactoring/moveClassToInner/moveIntoPrivateInnerClass/before/pack1/Class2.java
  260. 0  testdata/refactoring/moveClassToInner/moveMultiple1/after/pack1/empty.txt
  261. +0 −11 testdata/refactoring/moveClassToInner/moveMultiple1/after/pack2/A.java
  262. 0  testdata/refactoring/moveClassToInner/moveMultiple1/after/pack2/empty.txt
  263. +0 −6 testdata/refactoring/moveClassToInner/moveMultiple1/before/pack1/Class1.java
  264. +0 −4 testdata/refactoring/moveClassToInner/moveMultiple1/before/pack1/Class2.java
  265. 0  testdata/refactoring/moveClassToInner/moveMultiple1/before/pack1/empty.txt
  266. +0 −4 testdata/refactoring/moveClassToInner/moveMultiple1/before/pack2/A.java
  267. 0  testdata/refactoring/moveClassToInner/moveMultiple1/before/pack2/empty.txt
  268. +0 −4 testdata/refactoring/moveClassToInner/moveOfPackageLocalClass/before/pack1/Class1.java
  269. +0 −5 testdata/refactoring/moveClassToInner/moveOfPackageLocalClass/before/pack1/Class2.java
  270. +0 −4 testdata/refactoring/moveClassToInner/moveOfPackageLocalClass/before/pack2/A.java
  271. +0 −6 testdata/refactoring/moveClassToInner/moveWithPackageLocalMember/before/pack1/Class1.java
  272. +0 −8 testdata/refactoring/moveClassToInner/moveWithPackageLocalMember/before/pack1/Class2.java
  273. +0 −4 testdata/refactoring/moveClassToInner/moveWithPackageLocalMember/before/pack2/A.java
  274. +0 −6 testdata/refactoring/moveClassToInner/nonJava/after/pack1/A.java
  275. 0  testdata/refactoring/moveClassToInner/nonJava/after/pack1/empty.txt
  276. +0 −3  testdata/refactoring/moveClassToInner/nonJava/after/qqq.txt
  277. +0 −4 testdata/refactoring/moveClassToInner/nonJava/before/pack1/A.java
  278. +0 −4 testdata/refactoring/moveClassToInner/nonJava/before/pack1/Class1.java
  279. 0  testdata/refactoring/moveClassToInner/nonJava/before/pack1/empty.txt
  280. +0 −3  testdata/refactoring/moveClassToInner/nonJava/before/qqq.txt
  281. +0 −5 testdata/refactoring/moveClassToInner/packageLocalClass/before/pack1/Class1.java
  282. +0 −4 testdata/refactoring/moveClassToInner/packageLocalClass/before/pack1/Class2.java
  283. +0 −4 testdata/refactoring/moveClassToInner/packageLocalClass/before/pack2/A.java
  284. 0  testdata/refactoring/moveClassToInner/refToConstructor/after/pack1/empty.txt
  285. +0 −9 testdata/refactoring/moveClassToInner/refToConstructor/after/pack2/A.java
  286. 0  testdata/refactoring/moveClassToInner/refToConstructor/after/pack2/empty.txt
  287. +0 −7 testdata/refactoring/moveClassToInner/refToConstructor/before/pack1/Class1.java
  288. 0  testdata/refactoring/moveClassToInner/refToConstructor/before/pack1/empty.txt
  289. +0 −4 testdata/refactoring/moveClassToInner/refToConstructor/before/pack2/A.java
  290. 0  testdata/refactoring/moveClassToInner/refToConstructor/before/pack2/empty.txt
  291. 0  testdata/refactoring/moveClassToInner/refToInner/after/pack1/empty.txt
  292. +0 −11 testdata/refactoring/moveClassToInner/refToInner/after/pack2/A.java
  293. 0  testdata/refactoring/moveClassToInner/refToInner/after/pack2/empty.txt
  294. +0 −9 testdata/refactoring/moveClassToInner/refToInner/before/pack1/Class1.java
  295. 0  testdata/refactoring/moveClassToInner/refToInner/before/pack1/empty.txt
  296. +0 −4 testdata/refactoring/moveClassToInner/refToInner/before/pack2/A.java
  297. 0  testdata/refactoring/moveClassToInner/refToInner/before/pack2/empty.txt
  298. +0 −5 testdata/refactoring/moveClassToInner/secondaryClass/after/pack1/Class1.java
  299. +0 −10 testdata/refactoring/moveClassToInner/secondaryClass/after/pack1/User.java
  300. +0 −8 testdata/refactoring/moveClassToInner/secondaryClass/before/pack1/Class1.java
Sorry, we could not display the entire diff because too many files (508) changed.
115 test/org/jetbrains/plugins/scala/lang/refactoring/CopyClassTest.java
View
@@ -1,115 +0,0 @@
-package org.jetbrains.plugins.scala.lang.refactoring;
-
-import com.intellij.codeInsight.CodeInsightTestCase;
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.*;
-import com.intellij.psi.impl.source.PostprocessReformattingAspect;
-import com.intellij.psi.search.ProjectScope;
-import com.intellij.refactoring.copy.CopyClassesHandler;
-import com.intellij.testFramework.PlatformTestUtil;
-import com.intellij.testFramework.PsiTestUtil;
-import com.intellij.util.IncorrectOperationException;
-
-import java.io.File;
-import java.util.Collections;
-import java.util.HashMap;
-
-/**
- * @author yole
- */
-public class CopyClassTest extends CodeInsightTestCase {
- private VirtualFile myRootDir;
-
- public void testReplaceAllOccurrences() throws Exception {
- doTest("Foo", "Bar");
- }
-
- // TODO
-// public void testLibraryClass() throws Exception { // IDEADEV-28791
-// doTest("java.util.ArrayList", "Bar");
-// }
-
- private void doTest(final String oldName, final String copyName) throws Exception {
- String root = JavaTestUtil.getJavaTestDataPath() + "/refactoring/copyClass/" + getTestName(true);
-
- PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17("java 1.5"));
- myRootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
-
- PsiElement element = performAction(oldName, copyName);
-
- myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
- FileDocumentManager.getInstance().saveAllDocuments();
-
- VirtualFile fileAfter = myRootDir.findChild(copyName + ".java");
- VirtualFile fileExpected = myRootDir.findChild(copyName + ".expected.java");
-
- PlatformTestUtil.assertFilesEqual(fileExpected, fileAfter);
- }
-
- private PsiElement performAction(final String oldName, final String copyName) throws IncorrectOperationException {
- PsiClass oldClass = JavaPsiFacade.getInstance(myProject).findClass(oldName, ProjectScope.getAllScope(myProject));
- return CopyClassesHandler.doCopyClasses(Collections.singletonMap(oldClass.getNavigationElement().getContainingFile(), new PsiClass[]{oldClass}), copyName, myPsiManager.findDirectory(myRootDir),
- myProject);
- }
-
- public void testPackageLocalClasses() throws Exception {
- doMultifileTest();
- }
-
- public void testPackageLocalMethods() throws Exception {
- doMultifileTest();
- }
-
- //copy all classes from p1 -> p2
- private void doMultifileTest() throws Exception {
- String root = JavaTestUtil.getJavaTestDataPath() + "/refactoring/copyClass/multifile/" + getTestName(true);
- String rootBefore = root + "/before";
- PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
- VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
-
- final HashMap<PsiFile, PsiClass[]> map = new HashMap<PsiFile, PsiClass[]>();
- final VirtualFile sourceDir = rootDir.findChild("p1");
- for (VirtualFile file : sourceDir.getChildren()) {
- final PsiFile psiFile = myPsiManager.findFile(file);
- if (psiFile instanceof PsiJavaFile) {
- map.put(psiFile, ((PsiJavaFile)psiFile).getClasses());
- }
- }
-
- final VirtualFile targetVDir = rootDir.findChild("p2");
- CopyClassesHandler.doCopyClasses(map, null, myPsiManager.findDirectory(targetVDir), myProject);
-
- String rootAfter = root + "/after";
- VirtualFile rootDir2 = LocalFileSystem.getInstance().findFileByPath(rootAfter.replace(File.separatorChar, '/'));
- myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
- PlatformTestUtil.assertDirectoriesEqual(rootDir2, rootDir, PlatformTestUtil.CVS_FILE_FILTER);
- }
-
- public void testPackageHierarchy() throws Exception {
- doPackageCopy();
- }
-
- public void testPackageOneLevelHierarchy() throws Exception {
- doPackageCopy();
- }
-
- private void doPackageCopy() throws Exception {
- String root = JavaTestUtil.getJavaTestDataPath() + "/refactoring/copyClass/multifile/" + getTestName(true);
- String rootBefore = root + "/before";
- PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
- VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
-
- final VirtualFile targetVDir = rootDir.findChild("p2");
- final PsiDirectory sourceP1Dir = myPsiManager.findDirectory(rootDir.findChild("p1"));
- final PsiDirectory targetP2Dir = myPsiManager.findDirectory(targetVDir);
- new CopyClassesHandler().doCopy(new PsiElement[]{sourceP1Dir}, targetP2Dir);
-
- String rootAfter = root + "/after";
- VirtualFile rootDir2 = LocalFileSystem.getInstance().findFileByPath(rootAfter.replace(File.separatorChar, '/'));
- myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
- PlatformTestUtil.assertDirectoriesEqual(rootDir2, rootDir, PlatformTestUtil.CVS_FILE_FILTER);
- }
-}
95 test/org/jetbrains/plugins/scala/lang/refactoring/CopyTest.java
View
@@ -1,95 +0,0 @@
-/*
- * Copyright 2000-2011 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jetbrains.plugins.scala.lang.refactoring;
-
-import com.intellij.codeInsight.CodeInsightTestCase;
-import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.*;
-import com.intellij.refactoring.copy.CopyHandler;
-import com.intellij.testFramework.PlatformTestUtil;
-import com.intellij.testFramework.PsiTestUtil;
-
-public class CopyTest extends CodeInsightTestCase {
-
- private String getRoot() {
- return JavaTestUtil.getJavaTestDataPath() + "/refactoring/copy/multifile/" + getTestName(true);
- }
-
- public void testCopyAvailable() throws Exception {
- doTest();
- }
-
- public void testJavaAndTxt() throws Exception {
- doTest();
- }
-
- private void doTest() throws Exception {
- String rootBefore = getRoot();
- PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
- PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
- PsiPackage pack1 = myJavaFacade.findPackage("pack1");
- PsiPackage pack2 = myJavaFacade.findPackage("pack2");
- assertTrue(CopyHandler.canCopy(new PsiElement[]{pack1.getDirectories()[0], pack2.getDirectories()[0]}));
- }
-
- public void testMultipleClasses() throws Exception {
- String rootBefore = getRoot();
- PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
- final VirtualFile root = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
- final PsiClass aClass = myJavaFacade.findClass("pack1.Klass");
- assertNotNull(aClass);
-
- final PsiFile containingFile = aClass.getContainingFile();
-
- assertTrue(CopyHandler.canCopy(new PsiElement[]{containingFile}));
- assertFalse(CopyHandler.canClone(new PsiElement[]{containingFile}));
-
- PsiPackage pack2 = myJavaFacade.findPackage("pack2");
- final PsiDirectory targetDirectory = pack2.getDirectories()[0];
- CopyHandler.doCopy(new PsiElement[]{containingFile}, targetDirectory);
-
- VirtualFile fileAfter = root.findFileByRelativePath("pack2/Klass.java");
- VirtualFile fileExpected = root.findFileByRelativePath("pack2/Klass.expected.java");
-
- PlatformTestUtil.assertFilesEqual(fileExpected, fileAfter);
- }
-
- public void testMultipleFiles() throws Exception {
- String rootBefore = getRoot();
- PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
- final VirtualFile root = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
-
- final VirtualFile first = root.findFileByRelativePath("from/1.txt");
- assertNotNull(first);
- final VirtualFile second = root.findFileByRelativePath("from/2.txt");
- assertNotNull(second);
-
- final PsiFile firstPsi = myPsiManager.findFile(first);
- final PsiFile secondPsi = myPsiManager.findFile(second);
-
- assertTrue(CopyHandler.canCopy(new PsiElement[]{firstPsi, secondPsi}));
-
- final VirtualFile toDir = root.findChild("to");
- assertNotNull(toDir);
- final PsiDirectory targetDirectory = myPsiManager.findDirectory(toDir);
-
- CopyHandler.doCopy(new PsiElement[]{firstPsi, secondPsi}, targetDirectory);
-
- assertNotNull(root.findFileByRelativePath("to/1.txt"));
- assertNotNull(root.findFileByRelativePath("to/2.txt"));
- }
-}
56 test/org/jetbrains/plugins/scala/lang/refactoring/DndMoveTest.java
View
@@ -1,56 +0,0 @@
-package org.jetbrains.plugins.scala.lang.refactoring;
-
-import com.intellij.codeInsight.CodeInsightTestCase;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.JavaPsiFacade;
-import com.intellij.psi.PsiDirectory;
-import com.intellij.psi.PsiDocumentManager;
-import com.intellij.psi.PsiElement;
-import com.intellij.refactoring.move.MoveHandler;
-import com.intellij.testFramework.PsiTestUtil;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * User: anna
- * Date: Aug 31, 2010
- */
-public class DndMoveTest extends CodeInsightTestCase {
- @Override
- protected String getTestRoot() {
- return "/refactoring/dndMove/";
- }
-
- public void testPublicJavaClass() throws Exception {
- doTest("d", new Computable<PsiElement>() {
- @Nullable
- @Override
- public PsiElement compute() {
- return JavaPsiFacade.getInstance(getProject()).findClass("d.MyClass");
- }
- }, true);
- }
-
- public void testSecondJavaClass() throws Exception {
- doTest("d", new Computable<PsiElement>() {
- @Nullable
- @Override
- public PsiElement compute() {
- return JavaPsiFacade.getInstance(getProject()).findClass("d.Second");
- }
- }, false);
- }
-
-
- private void doTest(final String targetDirName, final Computable<PsiElement> source, final boolean expected) throws Exception {
- String testName = getTestName(true);
- String root = JavaTestUtil.getJavaTestDataPath() + getTestRoot() + testName;
- VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete, false);
- PsiTestUtil.addSourceContentToRoots(myModule, rootDir);
- PsiDocumentManager.getInstance(myProject).commitAllDocuments();
- final VirtualFile child1 = rootDir.findChild(targetDirName);
- assertNotNull("File " + targetDirName + " not found", child1);
- final PsiDirectory targetDirectory = myPsiManager.findDirectory(child1);
- assertEquals(expected, MoveHandler.isMoveRedundant(source.compute(), targetDirectory));
- }
-}
11 test/org/jetbrains/plugins/scala/lang/refactoring/JavaTestUtil.java
View
@@ -1,11 +0,0 @@
-package org.jetbrains.plugins.scala.lang.refactoring;
-
-import org.jetbrains.plugins.scala.util.TestUtils;
-
-import java.io.File;
-
-public class JavaTestUtil {
- static String getJavaTestDataPath() {
- return TestUtils.getTestDataPath();
- }
-}
84 test/org/jetbrains/plugins/scala/lang/refactoring/MoveClassAndFileTest.java
View
@@ -1,84 +0,0 @@
-/*
- * Copyright 2000-2010 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jetbrains.plugins.scala.lang.refactoring;
-
-/**
- * User: anna
- * Date: Aug 31, 2010
- */
-
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.*;
-import com.intellij.psi.impl.source.PostprocessReformattingAspect;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.refactoring.move.moveFilesOrDirectories.JavaMoveFilesOrDirectoriesHandler;
-import com.intellij.testFramework.IdeaTestUtil;
-import com.intellij.testFramework.PsiTestUtil;
-
-import java.io.File;
-
-public class MoveClassAndFileTest extends RefactoringTestCase {
-
- public void testAllClassesInFile() throws Exception {
- doTest("allClassesInFile", "t", "txt2move.txt", "s.MyClass", "s.MyOneMoreClass");
- }
-
- public void testOnlyPackageLocalClass() throws Exception {
- doTest("onlyPackageLocalClass", "t", "txt2move.txt", "s.MyLocal");
- }
-
- public void testLeavePackageLocalClass() throws Exception {
- doTest("leavePackageLocalClass", "t", "txt2move.txt", "s.MyClass");
- }
-
- private void doTest(String testName, String newPackageName, String fileNameNearFirstClass, String... classNames) throws Exception {
- String root = JavaTestUtil.getJavaTestDataPath() + "/refactoring/moveClassAndFile/" + testName;
-
- String rootBefore = root + "/before";
- PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
- VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
-
- performAction(newPackageName, fileNameNearFirstClass, classNames);
-
- String rootAfter = root + "/after";
- VirtualFile rootDir2 = LocalFileSystem.getInstance().findFileByPath(rootAfter.replace(File.separatorChar, '/'));
- myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
- IdeaTestUtil.assertDirectoriesEqual(rootDir2, rootDir, IdeaTestUtil.CVS_FILE_FILTER);
- }
-
- private void performAction(String newPackageName, String fileName, String... classNames) throws Exception{
- final PsiElement[] elements = new PsiElement[classNames.length + 1];
- for(int i = 0; i < classNames.length; i++){
- String className = classNames[i];
- elements[i] = myJavaFacade.findClass(className, GlobalSearchScope.projectScope(getProject()));
- assertNotNull("Class " + className + " not found", elements[i]);
- }
- elements[classNames.length] = elements[0].getContainingFile().getContainingDirectory().findFile(fileName);
-
- PsiPackage aPackage = JavaPsiFacade.getInstance(myPsiManager.getProject()).findPackage(newPackageName);
- assertNotNull("Package " + newPackageName + " not found", aPackage);
- final PsiDirectory[] dirs = aPackage.getDirectories();
- assertEquals(dirs.length, 1);
-
- new JavaMoveFilesOrDirectoriesHandler().doMove(getProject(), elements, dirs[0], null);
- PsiDocumentManager.getInstance(myProject).commitAllDocuments();
- FileDocumentManager.getInstance().saveAllDocuments();
- }
-}
-
125 test/org/jetbrains/plugins/scala/lang/refactoring/MoveClassTest.java
View
@@ -1,125 +0,0 @@
-package org.jetbrains.plugins.scala.lang.refactoring;
-
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.*;
-import com.intellij.psi.impl.source.PostprocessReformattingAspect;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.refactoring.BaseRefactoringProcessor;
-import com.intellij.refactoring.PackageWrapper;
-import com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesProcessor;
-import com.intellij.refactoring.move.moveClassesOrPackages.SingleSourceRootMoveDestination;
-import com.intellij.testFramework.PlatformTestUtil;
-import com.intellij.testFramework.PsiTestUtil;
-import org.jetbrains.annotations.NonNls;
-
-import java.io.File;
-
-public class MoveClassTest extends RefactoringTestCase {
- // DONE
- public void testContextChange() throws Exception{
- doTest("contextChange1", new String[]{"pack1.Class1"}, "pack2");
- doTest("contextChange2", new String[]{"pack1.Class1"}, "pack2");
- }
- // DONE
- public void testContextChangeWithObject() throws Exception{
- doTest("contextChangeWithObject", new String[]{"pack1.Class1$"}, "pack2");
- }
- // DONE
- public void testContextChangeWithCaseClass() throws Exception{
- doTest("contextChangeWithCaseClass", new String[]{"pack1.Class1"}, "pack2");
- }
- // DONE
- public void testMoveMultiple() throws Exception{
- doTest("moveMultiple1", new String[]{"pack1.Class1", "pack1.Class2"}, "pack2");
- }
- // DONE
- public void testSecondaryClass() throws Exception{
- doTest("secondaryClass", new String[]{"pack1.Class2"}, "pack1");
- }
-
- public void testStringsAndComments() throws Exception{
- doTest("stringsAndComments", new String[]{"pack1.Class1"}, "pack2");
- }
-
- public void testStringsAndComments2() throws Exception{
- doTest("stringsAndComments2", new String[]{"pack1.AClass"}, "pack2");
- }
-
- public void testNonJava() throws Exception{
- doTest("nonJava", new String[]{"pack1.Class1"}, "pack2");
- }
-
- // TODO
-// public void testRefInPropertiesFile() throws Exception{
-// doTest("refInPropertiesFile", new String[]{"p1.MyClass"}, "p");
-// }
-
- /* IMPLEMENT: getReferences() in JspAttributeValueImpl should be dealed with (soft refs?)
-
- public void testJsp() throws Exception{
- doTest("jsp", new String[]{"pack1.TestClass"}, "pack2");
- }
- */
-
- // DONE
- public void testLocalClass() throws Exception{
- doTest("localClass", new String[]{"pack1.A"}, "pack2");
- }
-
- public void testClassAndSecondary() throws Exception{
- try {
- doTest("classAndSecondary", new String[]{"pack1.Class1", "pack1.Class2"}, "pack2");
- fail("Conflicts expected");
- }
- catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
- assertEquals("A package-local class <b><code>Class2</code></b> will no longer be accessible from field <b><code>User.class2</code></b>", e.getMessage());
- }
- }
-
- public void testIdeadev27996() throws Exception {
- doTest("ideadev27996", new String[] { "pack1.X" }, "pack2");
- }
-
- public void testUnusedImport() throws Exception {
- doTest("unusedImport", new String[]{"p2.F2"}, "p1");
- }
-
- private void doTest(@NonNls String testName, @NonNls String[] classNames, @NonNls String newPackageName) throws Exception{
- String root = JavaTestUtil.getJavaTestDataPath() + "/refactoring/moveClass/" + testName;
-
- String rootBefore = root + "/before";
- PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
- VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
-
- performAction(classNames, newPackageName);
-
- String rootAfter = root + "/after";
- VirtualFile rootDir2 = LocalFileSystem.getInstance().findFileByPath(rootAfter.replace(File.separatorChar, '/'));
- myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
- PlatformTestUtil.assertDirectoriesEqual(rootDir2, rootDir, PlatformTestUtil.CVS_FILE_FILTER);
- }
-
- private void performAction(String[] classNames, String newPackageName) throws Exception{
- final PsiClass[] classes = new PsiClass[classNames.length];
- for(int i = 0; i < classes.length; i++){
- String className = classNames[i];
- classes[i] = myJavaFacade.findClass(className, GlobalSearchScope.projectScope(getProject()));
- assertNotNull("Class " + className + " not found", classes[i]);
- }
-
- PsiPackage aPackage = JavaPsiFacade.getInstance(myPsiManager.getProject()).findPackage(newPackageName);
- assertNotNull("Package " + newPackageName + " not found", aPackage);
- final PsiDirectory[] dirs = aPackage.getDirectories();
- assertEquals(dirs.length, 1);
-
- new MoveClassesOrPackagesProcessor(myProject, classes,
- new SingleSourceRootMoveDestination(PackageWrapper.create(JavaDirectoryService
- .getInstance().getPackage(dirs[0])), dirs[0]),
- true, true, null).run();
- PsiDocumentManager.getInstance(myProject).commitAllDocuments();
- FileDocumentManager.getInstance().saveAllDocuments();
- }
-}
154 test/org/jetbrains/plugins/scala/lang/refactoring/MoveClassToInnerTest.java
View
@@ -1,154 +0,0 @@
-package org.jetbrains.plugins.scala.lang.refactoring;
-
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiDocumentManager;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
-import com.intellij.psi.impl.source.PostprocessReformattingAspect;
-import com.intellij.psi.search.ProjectScope;
-import com.intellij.refactoring.move.moveClassesOrPackages.MoveClassToInnerProcessor;
-import com.intellij.testFramework.IdeaTestUtil;
-import com.intellij.testFramework.PsiTestUtil;
-import com.intellij.usageView.UsageInfo;
-import com.intellij.util.containers.MultiMap;
-
-import java.io.File;
-
-/**
- * @author yole
- */
-public class MoveClassToInnerTest extends RefactoringTestCase {
- public void testContextChange1() throws Exception {
- doTest(new String[] { "pack1.Class1" }, "pack2.A");
- }
-
- public void testContextChange2() throws Exception {
- doTest(new String[] { "pack1.Class1" }, "pack2.A");
- }
-
- public void testInnerImport() throws Exception {
- doTest(new String[] { "pack1.Class1" }, "pack2.A");
- }
-
- public void testInsertInnerClassImport() throws Exception {
- final boolean imports = CodeStyleSettingsManager.getSettings(myProject).INSERT_INNER_CLASS_IMPORTS;
- try {
- CodeStyleSettingsManager.getSettings(myProject).INSERT_INNER_CLASS_IMPORTS = true;
- doTest(new String[] { "pack1.Class1" }, "pack2.A");
- }
- finally {
- CodeStyleSettingsManager.getSettings(myProject).INSERT_INNER_CLASS_IMPORTS = imports;
- }
- }
-
- public void testSimultaneousMove() throws Exception {
- doTest(new String[] { "pack1.Class1", "pack0.Class0" }, "pack2.A");
- }
-
- public void testMoveMultiple1() throws Exception {
- doTest(new String[] { "pack1.Class1", "pack1.Class2" }, "pack2.A");
- }
-
- public void testRefToInner() throws Exception {
- doTest(new String[] { "pack1.Class1" }, "pack2.A");
- }
-
- public void testRefToConstructor() throws Exception {
- doTest(new String[] { "pack1.Class1" }, "pack2.A");
- }
-
- public void testSecondaryClass() throws Exception {
- doTest(new String[] { "pack1.Class2" }, "pack1.User");
- }
-
- public void testStringsAndComments() throws Exception {
- doTest(new String[] { "pack1.Class1" }, "pack1.A");
- }
-
- public void testStringsAndComments2() throws Exception {
- doTest(new String[] { "pack1.Class1" }, "pack1.A");
- }
-
- public void testNonJava() throws Exception {
- doTest(new String[] { "pack1.Class1" }, "pack1.A");
- }
-
- public void testLocallyUsedPackageLocalToPublicInterface() throws Exception {
- doTest(new String[]{"pack1.Class1"}, "pack2.A");
- }
-
- public void testPackageLocalClass() throws Exception {
- doTestConflicts("pack1.Class1", "pack2.A", "Field <b><code>Class1.c2</code></b> uses a package-local class <b><code>pack1.Class2</code></b>.");
- }
-
- public void testMoveIntoPackageLocalClass() throws Exception {
- doTestConflicts("pack1.Class1", "pack2.A", "Class <b><code>Class1</code></b> will no longer be accessible from field <b><code>Class2.c1</code></b>");
- }
-
- public void testMoveOfPackageLocalClass() throws Exception {
- doTestConflicts("pack1.Class1", "pack2.A", "Class <b><code>Class1</code></b> will no longer be accessible from field <b><code>Class2.c1</code></b>");
- }
-
- public void testMoveIntoPrivateInnerClass() throws Exception {
- doTestConflicts("pack1.Class1", "pack1.A.PrivateInner", "Class <b><code>Class1</code></b> will no longer be accessible from field <b><code>Class2.c1</code></b>");
- }
-
- public void testMoveWithPackageLocalMember() throws Exception {
- doTestConflicts("pack1.Class1", "pack2.A", "Method <b><code>Class1.doStuff()</code></b> will no longer be accessible from method <b><code>Class2.test()</code></b>");
- }
-
- public void testDuplicateInner() throws Exception {
- doTestConflicts("pack1.Class1", "pack2.A", "Class <b><code>pack2.A</code></b> already contains an inner class named <b><code>Class1</code></b>");
- }
-
- private void doTest(String[] classNames, String targetClassName) throws Exception{
- VirtualFile rootDir = prepareTest();
-
- performAction(classNames, targetClassName);
-
- String rootAfter = getRoot() + "/after";
- VirtualFile rootDir2 = LocalFileSystem.getInstance().findFileByPath(rootAfter.replace(File.separatorChar, '/'));
- myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
- IdeaTestUtil.assertDirectoriesEqual(rootDir2, rootDir, IdeaTestUtil.CVS_FILE_FILTER);
- }
-
- private VirtualFile prepareTest() throws Exception {
- String rootBefore = getRoot() + "/before";
- PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
- return PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
- }
-
- private String getRoot() {
- return JavaTestUtil.getJavaTestDataPath() + "/refactoring/moveClassToInner/" + getTestName(true);
- }
-
- private void doTestConflicts(String className, String targetClassName, String... expectedConflicts) throws Exception {
- prepareTest();
- PsiClass classToMove = myJavaFacade.findClass(className, ProjectScope.getAllScope(myProject));
- PsiClass targetClass = myJavaFacade.findClass(targetClassName, ProjectScope.getAllScope(myProject));
- MoveClassToInnerProcessor processor = new MoveClassToInnerProcessor(myProject, new PsiClass[]{classToMove}, targetClass, true, true, null);
- UsageInfo[] usages = processor.findUsages();
- MultiMap<PsiElement,String> conflicts = processor.getConflicts(usages);
- assertSameElements(conflicts.values() , expectedConflicts);
- }
-
- private void performAction(String[] classNames, String targetClassName) throws Exception{
- final PsiClass[] classes = new PsiClass[classNames.length];
- for(int i = 0; i < classes.length; i++){
- String className = classNames[i];
- classes[i] = myJavaFacade.findClass(className, ProjectScope.getAllScope(myProject));
- assertNotNull("Class " + className + " not found", classes[i]);
- }
-
- PsiClass targetClass = myJavaFacade.findClass(targetClassName, ProjectScope.getAllScope(myProject));
- assertNotNull(targetClass);
-
- new MoveClassToInnerProcessor(myProject, classes, targetClass, true, true, null).run();
- PsiDocumentManager.getInstance(myProject).commitAllDocuments();
- FileDocumentManager.getInstance().saveAllDocuments();
- }
-}
156 test/org/jetbrains/plugins/scala/lang/refactoring/MoveInnerTest.java
View
@@ -1,156 +0,0 @@
-package org.jetbrains.plugins.scala.lang.refactoring;
-
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.*;
-import com.intellij.psi.impl.source.PostprocessReformattingAspect;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.refactoring.BaseRefactoringProcessor;
-import com.intellij.refactoring.MultiFileTestCase;
-import com.intellij.refactoring.move.moveInner.MoveInnerDialog;
-import com.intellij.refactoring.move.moveInner.MoveInnerImpl;
-import com.intellij.refactoring.move.moveInner.MoveInnerProcessor;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author dsl
- */
-public class MoveInnerTest extends MultiFileTestCase {
- @Override
- protected String getTestDataPath() {
- return JavaTestUtil.getJavaTestDataPath();
- }
-
- @Override
- protected String getTestRoot() {
- return "/refactoring/moveInner/";
- }
-
- public void testScr13730() throws Exception {
- doTest(createAction("pack1.TopLevel.StaticInner", "StaticInner", false, null, false, false, null));
- }
-
- public void testScr15142() throws Exception {
- doTest(createAction("xxx.Outer.Inner", "Inner", false, null, false, false, null));
- }
-
- public void testNonJavaFiles() throws Exception {
- doTest(createAction("pack1.Outer.Inner", "Inner", false, null, true, true, null));
- }
-
- // TODO
-// public void testXmlReferences() throws Exception {
-// doTest(createAction("pack1.Outer.Inner", "Inner", false, null, true, true, null));
-// }
-
- public void testScr22592() throws Exception {
- doTest(createAction("xxx.Outer.Inner", "Inner", true, "outer", false, false, null));
- }
-
- public void testInnerClassInheritance() throws Exception {
- try {
- doTest(createAction("p.A.B", "B", false, null, false, false, null));
- fail("Conflict was not detected");
- }
- catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
- assertEquals("class <b><code>p.A.C</code></b> will become inaccessible from class <b><code>p.A.B</code></b>.", e.getMessage());
- }
- }
-
- public void testScr30106() throws Exception {
- doTest(createAction("p.A.B", "B", true, "outer", false, false, null));
- }
-
- public void testConstructorVisibility() throws Exception { // IDEADEV-19561
- doTest(createAction("p.A.B", "B", false, null, false, false, null));
- }
-
- public void testFieldAccessInSuper() throws Exception {
- doTest(createAction("p.A.B", "B", true, "a", false, false, null));
- }
-
- public void testToOtherPackage() throws Exception {
- doTest(createAction("package1.OuterClass.InnerClass", "InnerClass", false, null, false, false, "package2"));
- }
-
- public void testImportStaticOfEnum() throws Exception { // IDEADEV-28619
- doTest(createAction("p.A.E", "E", false, null, false, false, null));
- }
-
- public void testEnumConstructorVisibility() throws Exception { // IDEADEV-28619
- doTest(createAction("p.A.E", "E", false, null, false, false, "p2"));
- }
-
- public void testQualifyThisHierarchy() throws Exception {
- final String innerClassName = "pack1.DImpl.MyRunnable";
- doTest(new MyPerformAction(innerClassName, "MyRunnable", false, "d",
- false, false, null) {
- @Override
- protected boolean isPassOuterClass() {
- final PsiClass outerClass = getJavaFacade().findClass("pack1.DImpl", GlobalSearchScope.moduleScope(myModule));
- assertNotNull(outerClass);
- final PsiClass innerClass = getJavaFacade().findClass(innerClassName, GlobalSearchScope.moduleScope(myModule));
- assertNotNull(innerClass);
- return MoveInnerDialog.isThisNeeded(innerClass, outerClass);
- }
- });
- }
-
- private PerformAction createAction(@NonNls final String innerClassName,
- @NonNls final String newClassName,
- final boolean passOuterClass,
- @NonNls final String parameterName,
- final boolean searchInComments,
- final boolean searchInNonJava,
- @NonNls @Nullable final String packageName) {
- return new MyPerformAction(innerClassName, newClassName, passOuterClass, parameterName, searchInComments, searchInNonJava, packageName);
- }
-
- private class MyPerformAction implements PerformAction {
- private final String myInnerClassName;
- private final String myPackageName;
- private final String myNewClassName;
- private final boolean myPassOuterClass;
- private final String myParameterName;
- private final boolean mySearchInComments;
- private final boolean mySearchInNonJava;
-
- public MyPerformAction(String innerClassName, String newClassName, boolean passOuterClass, String parameterName, boolean searchInComments,
- boolean searchInNonJava,
- String packageName) {
- myInnerClassName = innerClassName;
- myPackageName = packageName;
- myNewClassName = newClassName;
- myPassOuterClass = passOuterClass;
- myParameterName = parameterName;
- mySearchInComments = searchInComments;
- mySearchInNonJava = searchInNonJava;
- }
-
- @Override
- public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
- final JavaPsiFacade manager = getJavaFacade();
- final PsiClass aClass = manager.findClass(myInnerClassName, GlobalSearchScope.moduleScope(myModule));
- final MoveInnerProcessor moveInnerProcessor = new MoveInnerProcessor(myProject, null);
- final PsiElement targetContainer = myPackageName != null ? findDirectory(myPackageName) : MoveInnerImpl.getTargetContainer(aClass, false);
- assertNotNull(targetContainer);
- moveInnerProcessor.setup(aClass, myNewClassName, isPassOuterClass(), myParameterName, mySearchInComments, mySearchInNonJava, targetContainer);
- moveInnerProcessor.run();
- PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting();
- PsiDocumentManager.getInstance(myProject).commitAllDocuments();
- FileDocumentManager.getInstance().saveAllDocuments();
- }
-
- protected boolean isPassOuterClass() {
- return myPassOuterClass;
- }
-
- private PsiElement findDirectory(final String packageName) {
- final PsiPackage aPackage = JavaPsiFacade.getInstance(myPsiManager.getProject()).findPackage(packageName);
- assert aPackage != null;
- final PsiDirectory[] directories = aPackage.getDirectories();
- return directories [0];
- }
- }
-}
178 test/org/jetbrains/plugins/scala/lang/refactoring/MovePackageAsDirectoryTest.java
View
@@ -1,178 +0,0 @@
-/*
- * Copyright 2000-2011 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jetbrains.plugins.scala.lang.refactoring;
-
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.roots.ContentEntry;
-import com.intellij.openapi.roots.ModifiableRootModel;
-import com.intellij.openapi.roots.ModuleRootManager;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.vfs.VirtualFileAdapter;
-import com.intellij.openapi.vfs.VirtualFileEvent;
-import com.intellij.openapi.vfs.VirtualFileManager;
-import com.intellij.psi.JavaPsiFacade;
-import com.intellij.psi.PsiDirectory;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiPackage;
-import com.intellij.refactoring.MultiFileTestCase;
-import com.intellij.refactoring.move.moveClassesOrPackages.MoveDirectoryWithClassesProcessor;
-import junit.framework.Assert;
-
-import java.util.Arrays;
-import java.util.Comparator;
-
-public class MovePackageAsDirectoryTest extends MultiFileTestCase {
-
- @Override
- protected String getTestDataPath() {
- return JavaTestUtil.getJavaTestDataPath();
- }
-
- @Override
- protected String getTestRoot() {
- return "/refactoring/movePackageAsDir/";
- }
-
- public void testMovePackage() throws Exception {
- doTest(createAction("pack1", "target"));
- }
-
- public void testMovePackageWithTxtFilesInside() throws Exception {
- doTest(createAction("pack1", "target"));
- }
-
- public void testMultipleClassesInOneFile() throws Exception {
- final boolean [] fileWasDeleted = new boolean[]{false};
- final VirtualFileAdapter fileAdapter = new VirtualFileAdapter() {
- @Override
- public void fileDeleted(VirtualFileEvent event) {
- fileWasDeleted[0] = !event.getFile().isDirectory();
- }
- };
- VirtualFileManager.getInstance().addVirtualFileListener(fileAdapter);
- try {
- doTest(createAction("pack1", "target"));
- }
- finally {
- VirtualFileManager.getInstance().removeVirtualFileListener(fileAdapter);
- }
- Assert.assertFalse("Deleted instead of moved", fileWasDeleted[0]);
- }
-
-
- public void testRemoveUnresolvedImports() throws Exception {
- doTest(createAction("pack1", "target"));
- }
-
- public void testXmlDirRefs() throws Exception {
- doTest(createAction("pack1", "target"));
- }
-
- public void testXmlEmptyDirRefs() throws Exception {
- final String packageName = "pack1";
- doTest(new MyPerformAction(packageName, "target"){
- private static final String EMPTY_TXT = "empty.txt";
- @Override
- protected void preprocessSrcDir(PsiDirectory srcDirectory) {
- final PsiFile empty = srcDirectory.findFile(EMPTY_TXT);
- assert empty != null;
- ApplicationManager.getApplication().runWriteAction(new Runnable() {
- public void run() {
- empty.delete();
- }
- });
- }
-
- @Override
- protected void postProcessTargetDir(PsiDirectory targetDirectory) {
- final PsiDirectory subdirectory = targetDirectory.findSubdirectory(packageName);
- assert subdirectory != null;
- ApplicationManager.getApplication().runWriteAction(new Runnable() {
- public void run() {
- subdirectory.createFile(EMPTY_TXT);
- }
- });
- }
- });
- }
-
- private PerformAction createAction(final String packageName, final String targetPackageName) {
- return new MyPerformAction(packageName, targetPackageName);
- }
-
- @Override
- protected void prepareProject(VirtualFile rootDir) {
- final ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
- final ContentEntry contentEntry = rootModel.addContentEntry(rootDir);
- final VirtualFile[] children = rootDir.getChildren();
- for (VirtualFile child : children) {
- if (child.getName().startsWith("src")) {
- contentEntry.addSourceFolder(child, false);
- }
- }
-
- ApplicationManager.getApplication().runWriteAction(new Runnable() {
- @Override
- public void run() {
- rootModel.commit();
- }
- });
- }
-
- private class MyPerformAction implements PerformAction {
- private final String myPackageName;
- private final String myTargetPackageName;
-
- public MyPerformAction(String packageName, String targetPackageName) {
- myPackageName = packageName;
- myTargetPackageName = targetPackageName;
- }
-
- @Override
- public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
- final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(myProject);
- final Comparator<PsiDirectory> directoryComparator = new Comparator<PsiDirectory>() {
- @Override
- public int compare(PsiDirectory o1, PsiDirectory o2) {
- return o1.getVirtualFile().getPresentableUrl().compareTo(o2.getVirtualFile().getPresentableUrl());
- }
- };
-
- final PsiPackage sourcePackage = psiFacade.findPackage(myPackageName);
- assertNotNull(sourcePackage);
- final PsiDirectory[] srcDirectories = sourcePackage.getDirectories();
- assertEquals(srcDirectories.length, 2);
- Arrays.sort(srcDirectories, directoryComparator);
-
- final PsiPackage targetPackage = psiFacade.findPackage(myTargetPackageName);
- assertNotNull(targetPackage);
- final PsiDirectory[] targetDirectories = targetPackage.getDirectories();
- Arrays.sort(targetDirectories, directoryComparator);
- assertTrue(targetDirectories.length > 0);
- preprocessSrcDir(srcDirectories[0]);
- new MoveDirectoryWithClassesProcessor(getProject(), new PsiDirectory[]{srcDirectories[0]}, targetDirectories[0], false, false, true, null).run();
- postProcessTargetDir(targetDirectories[0]);
- FileDocumentManager.getInstance().saveAllDocuments();
- }
-
- protected void postProcessTargetDir(PsiDirectory targetDirectory) {
- }
-
- protected void preprocessSrcDir(PsiDirectory srcDirectory) {
- }
- }
-}
91 test/org/jetbrains/plugins/scala/lang/refactoring/MovePackageMultirootTest.java
View
@@ -1,91 +0,0 @@
-/*
- * Copyright 2000-2011 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jetbrains.plugins.scala.lang.refactoring;
-
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.roots.ContentEntry;
-import com.intellij.openapi.roots.ModifiableRootModel;
-import com.intellij.openapi.roots.ModuleRootManager;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.JavaPsiFacade;
-import com.intellij.psi.PsiManager;
-import com.intellij.psi.PsiPackage;
-import com.intellij.refactoring.MultiFileTestCase;
-import com.intellij.refactoring.PackageWrapper;
-import com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesProcessor;
-import com.intellij.refactoring.move.moveClassesOrPackages.MultipleRootsMoveDestination;
-
-/**
- * @author dsl
- */
-public class MovePackageMultirootTest extends MultiFileTestCase {
-
- @Override
- protected String getTestDataPath() {
- return JavaTestUtil.getJavaTestDataPath();
- }
-
- @Override
- protected String getTestRoot() {
- return "/refactoring/movePackageMultiroot/";
- }
-
- public void testMovePackage() throws Exception {
- doTest(createAction(new String[]{"pack1"}, "target"));
- }
-
- private PerformAction createAction(final String[] packageNames, final String targetPackageName) {
- return new PerformAction() {
- @Override
- public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
- final PsiManager manager = PsiManager.getInstance(myProject);
- PsiPackage[] sourcePackages = new PsiPackage[packageNames.length];
- for (int i = 0; i < packageNames.length; i++) {
- String packageName = packageNames[i];
- sourcePackages[i] = JavaPsiFacade.getInstance(manager.getProject()).findPackage(packageName);
- assertNotNull(sourcePackages[i]);
- }
- PsiPackage targetPackage = JavaPsiFacade.getInstance(manager.getProject()).findPackage(targetPackageName);
- assertNotNull(targetPackage);
- new MoveClassesOrPackagesProcessor(myProject, sourcePackages,
- new MultipleRootsMoveDestination(new PackageWrapper(targetPackage)),
- true, true, null).run();
- FileDocumentManager.getInstance().saveAllDocuments();
- }
- };
- }
-
- @Override
- protected void prepareProject(VirtualFile rootDir) {
- final ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
- final ContentEntry contentEntry = rootModel.addContentEntry(rootDir);
- final VirtualFile[] children = rootDir.getChildren();
- for (int i = 0; i < children.length; i++) {
- VirtualFile child = children[i];
- if (child.getName().startsWith("src")) {
- contentEntry.addSourceFolder(child, false);
- }
- }
-
- ApplicationManager.getApplication().runWriteAction(new Runnable() {
- @Override
- public void run() {
- rootModel.commit();
- }
- });
- }
-}
69 test/org/jetbrains/plugins/scala/lang/refactoring/MovePackageTest.java
View
@@ -1,69 +0,0 @@
-package org.jetbrains.plugins.scala.lang.refactoring;
-
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.JavaPsiFacade;
-import com.intellij.psi.PsiDirectory;
-import com.intellij.psi.PsiPackage;
-import com.intellij.refactoring.MultiFileTestCase;
-import com.intellij.refactoring.PackageWrapper;
-import com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesProcessor;
-import com.intellij.refactoring.move.moveClassesOrPackages.SingleSourceRootMoveDestination;
-
-public class MovePackageTest extends MultiFileTestCase {
-
- @Override
- protected String getTestDataPath() {
- return JavaTestUtil.getJavaTestDataPath();
- }
-
- public void testMoveSingle() throws Exception {
- doTest(new String[]{"pack1"}, "target");
- }
-
-/* IMPLEMENT: soft references in JSP
- public void testJsp() throws Exception {
- doTest(new String[]{"pack1"}, "target");
- }
-*/
- public void testQualifiedRef() throws Exception {
- doTest(new String[]{"package1.test"}, "package2");
- }
-
- public void testInsidePackage() throws Exception {
- doTest(new String[]{"a"}, "a.b");
- }
-
- @Override
- protected String getTestRoot() {
- return "/refactoring/movePackage/";
- }
-
- private void doTest(final String[] packageNames, final String newPackageName) throws Exception {
- doTest(new PerformAction() {
- @Override
- public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
- MovePackageTest.this.performAction(packageNames, newPackageName);
- }
- });
- }
-
- private void performAction(String[] packageNames, String newPackageName) throws Exception {
- final PsiPackage[] packages = new PsiPackage[packageNames.length];
- for (int i = 0; i < packages.length; i++) {
- String packageName = packageNames[i];
- packages[i] = JavaPsiFacade.getInstance(myPsiManager.getProject()).findPackage(packageName);
- assertNotNull("Package " + packageName + " not found", packages[i]);
- }
-
- PsiPackage newParentPackage = JavaPsiFacade.getInstance(myPsiManager.getProject()).findPackage(newPackageName);
- assertNotNull(newParentPackage);
- final PsiDirectory[] dirs = newParentPackage.getDirectories();
- assertEquals(dirs.length, 1);
-
- new MoveClassesOrPackagesProcessor(myProject, packages,
- new SingleSourceRootMoveDestination(PackageWrapper.create(newParentPackage), dirs[0]),
- true, false, null).run();
- FileDocumentManager.getInstance().saveAllDocuments();
- }
-}
26 test/org/jetbrains/plugins/scala/lang/refactoring/RefactoringTestCase.java
View
@@ -1,26 +0,0 @@
-/*
- * Copyright 2000-2011 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jetbrains.plugins.scala.lang.refactoring;
-
-import com.intellij.codeInsight.CodeInsightTestCase;
-
-public abstract class RefactoringTestCase extends CodeInsightTestCase {
- @Override
- protected boolean isRunInWriteAction() {
- return false;
- }
-}
-
107 test/org/jetbrains/plugins/scala/lang/refactoring/RenameClassTest.java
View
@@ -1,107 +0,0 @@
-package org.jetbrains.plugins.scala.lang.refactoring;
-
-import com.intellij.openapi.extensions.Extensions;
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiDocumentManager;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.refactoring.MultiFileTestCase;
-import com.intellij.refactoring.rename.RenameProcessor;
-import com.intellij.refactoring.rename.naming.AutomaticRenamerFactory;
-import org.jetbrains.annotations.NonNls;
-
-public class RenameClassTest extends MultiFileTestCase {
- @Override
- protected String getTestDataPath() {
- return JavaTestUtil.getJavaTestDataPath();
- }
-
- public void testNonJava() throws Exception {
- doTest("pack1.Class1", "Class1New");
- }
-
- // TODO
-// public void testCollision() throws Exception {
-// doTest("pack1.MyList", "List");
-// }
-
- public void testInnerClass() throws Exception {
- doTest("pack1.OuterClass.InnerClass", "NewInnerClass");
- }
-
- public void testImport() throws Exception {
- doTest("a.Blubfoo", "BlubFoo");
- }
-
- public void testConstructorJavadoc() throws Exception {
- doTest("Test", "Test1");
- }
-
- // TODO
-// public void testCollision1() throws Exception {
-// doTest("Loader", "Reader");
-// }
-
- public void testImplicitReferenceToDefaultCtr() throws Exception {
- doTest("pack1.Parent", "ParentXXX");
- }
-
- // TODO
-// public void testImplicitlyImported() throws Exception {
-// doTest("pack1.A", "Object");
-// }
-
- public void testAutomaticRenameVars() throws Exception {
- doRenameClass("XX", "Y");
- }
-
- private void doRenameClass(final String className, final String newName) throws Exception {
- doTest(new PerformAction() {
- @Override
- public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
- PsiClass aClass = myJavaFacade.findClass(className, GlobalSearchScope.allScope(getProject()));
- assertNotNull("Class XX not found", aClass);
-
- final RenameProcessor processor = new RenameProcessor(myProject, aClass, newName, true, true);
- for (AutomaticRenamerFactory factory : Extensions.getExtensions(AutomaticRenamerFactory.EP_NAME)) {
- processor.addRenamerFactory(factory);
- }
- processor.run();
- PsiDocumentManager.getInstance(myProject).commitAllDocuments();
- FileDocumentManager.getInstance().saveAllDocuments();
- }
- });
- }
-
- public void testAutomaticRenameInheritors() throws Exception {
- doRenameClass("MyClass", "MyClass1");
- }
-
- public void testAutomaticRenameVarsCollision() throws Exception {
- doTest("XX", "Y");
- }
-
- private void doTest(@NonNls final String qClassName, @NonNls final String newName) throws Exception {
- doTest(new PerformAction() {
- @Override
- public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
- RenameClassTest.this.performAction(qClassName, newName);
- }
- });
- }
-
- private void performAction(String qClassName, String newName) throws Exception {
- PsiClass aClass = myJavaFacade.findClass(qClassName, GlobalSearchScope.allScope(getProject()));
- assertNotNull("Class " + qClassName + " not found", aClass);
-
- new RenameProcessor(myProject, aClass, newName, true, true).run();
- PsiDocumentManager.getInstance(myProject).commitAllDocuments();
- FileDocumentManager.getInstance().saveAllDocuments();
- }
-
- @Override
- protected String getTestRoot() {
- return "/refactoring/renameClass/";
- }
-}
0  testdata/refactoring/copy/multifile/copyAvailable/pack1/p1.txt
View
No changes.
0  testdata/refactoring/copy/multifile/copyAvailable/pack2/pack2.txt
View
No changes.
2  testdata/refactoring/copy/multifile/javaAndTxt/pack1/Class1.java
View
@@ -1,2 +0,0 @@
-package pack1;
-public class Class1 {}
0  testdata/refactoring/copy/multifile/javaAndTxt/pack1/p1.txt
View
No changes.
2  testdata/refactoring/copy/multifile/javaAndTxt/pack2/Class2.java
View
@@ -1,2 +0,0 @@
-package pack2;
-public Class2{}
0  testdata/refactoring/copy/multifile/javaAndTxt/pack2/p2.txt
View
No changes.
6 testdata/refactoring/copy/multifile/multipleClasses/pack1/Klass.java
View
@@ -1,6 +0,0 @@
-package pack1;
-class Klass {
-}
-
-class AnotherKlass {
-}
6 testdata/refactoring/copy/multifile/multipleClasses/pack2/Klass.expected.java
View
@@ -1,6 +0,0 @@
-package pack2;
-class Klass {
-}
-
-class AnotherKlass {
-}
0  testdata/refactoring/copy/multifile/multipleFiles/from/1.txt
View
No changes.
0  testdata/refactoring/copy/multifile/multipleFiles/from/2.txt
View
No changes.
0  testdata/refactoring/copy/multifile/multipleFiles/to/empty.txt
View
No changes.
592 testdata/refactoring/copyClass/libraryClass/Bar.expected.java
View
@@ -1,592 +0,0 @@
-/*
- * @(#)ArrayList.java 1.46 03/06/22
- *
- * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
- */
-
-import java.util.AbstractList;
-import java.util.Collection;
-import java.util.List;
-import java.util.RandomAccess;
-
-/**
- * Resizable-array implementation of the <tt>List</tt> interface. Implements
- * all optional list operations, and permits all elements, including
- * <tt>null</tt>. In addition to implementing the <tt>List</tt> interface,
- * this class provides methods to manipulate the size of the array that is
- * used internally to store the list. (This class is roughly equivalent to
- * <tt>Vector</tt>, except that it is unsynchronized.)<p>
- *
- * The <tt>size</tt>, <tt>isEmpty</tt>, <tt>get</tt>, <tt>set</tt>,
- * <tt>iterator</tt>, and <tt>listIterator</tt> operations run in constant
- * time. The <tt>add</tt> operation runs in <i>amortized constant time</i>,
- * that is, adding n elements requires O(n) time. All of the other operations
- * run in linear time (roughly speaking). The constant factor is low compared
- * to that for the <tt>LinkedList</tt> implementation.<p>
- *
- * Each <tt>ArrayList</tt> instance has a <i>capacity</i>. The capacity is
- * the size of the array used to store the elements in the list. It is always
- * at least as large as the list size. As elements are added to an ArrayList,
- * its capacity grows automatically. The details of the growth policy are not
- * specified beyond the fact that adding an element has constant amortized
- * time cost.<p>
- *
- * An application can increase the capacity of an <tt>ArrayList</tt> instance
- * before adding a large number of elements using the <tt>ensureCapacity</tt>
- * operation. This may reduce the amount of incremental reallocation.<p>
- *
- * <strong>Note that this implementation is not synchronized.</strong> If
- * multiple threads access an <tt>ArrayList</tt> instance concurrently, and at
- * least one of the threads modifies the list structurally, it <i>must</i> be
- * synchronized externally. (A structural modification is any operation that
- * adds or deletes one or more elements, or explicitly resizes the backing
- * array; merely setting the value of an element is not a structural
- * modification.) This is typically accomplished by synchronizing on some
- * object that naturally encapsulates the list. If no such object exists, the
- * list should be "wrapped" using the <tt>Collections.synchronizedList</tt>
- * method. This is best done at creation time, to prevent accidental
- * unsynchronized access to the list:
- * <pre>
- * List list = Collections.synchronizedList(new ArrayList(...));
- * </pre><p>
- *
- * The iterators returned by this class's <tt>iterator</tt> and
- * <tt>listIterator</tt> methods are <i>fail-fast</i>: if list is structurally
- * modified at any time after the iterator is created, in any way except
- * through the iterator's own remove or add methods, the iterator will throw a
- * ConcurrentModificationException. Thus, in the face of concurrent
- * modification, the iterator fails quickly and cleanly, rather than risking
- * arbitrary, non-deterministic behavior at an undetermined time in the
- * future.<p>
- *
- * Note that the fail-fast behavior of an iterator cannot be guaranteed
- * as it is, generally speaking, impossible to make any hard guarantees in the
- * presence of unsynchronized concurrent modification. Fail-fast iterators
- * throw <tt>ConcurrentModificationException</tt> on a best-effort basis.
- * Therefore, it would be wrong to write a program that depended on this
- * exception for its correctness: <i>the fail-fast behavior of iterators
- * should be used only to detect bugs.</i><p>
- *
- * This class is a member of the
- * <a href="{@docRoot}/../guide/collections/index.html">
- * Java Collections Framework</a>.
- *
- * @author Josh Bloch
- * @author Neal Gafter
- * @version 1.46, 06/22/03
- * @see java.util.Collection
- * @see java.util.List
- * @see LinkedList
- * @see Vector
- * @see java.util.Collections#synchronizedList(java.util.List)
- * @since 1.2
- */
-
-public class Bar<E> extends AbstractList<E>
- implements List<E>, RandomAccess, Cloneable, java.io.Serializable
-{
- private static final long serialVersionUID = 8683452581122892189L;
-
- /**
- * The array buffer into which the elements of the ArrayList are stored.
- * The capacity of the ArrayList is the length of this array buffer.
- */
- private transient E[] elementData;
-
- /**
- * The size of the ArrayList (the number of elements it contains).
- *
- * @serial
- */
- private int size;
-
- /**
- * Constructs an empty list with the specified initial capacity.
- *
- * @param initialCapacity the initial capacity of the list.
- * @exception IllegalArgumentException if the specified initial capacity
- * is negative
- */
- public Bar(int initialCapacity) {
- super();
- if (initialCapacity < 0)
- throw new IllegalArgumentException("Illegal Capacity: "+
- initialCapacity);
- this.elementData = (E[])new Object[initialCapacity];
- }
-
- /**
- * Constructs an empty list with an initial capacity of ten.
- */
- public Bar() {
- this(10);
- }
-
- /**
- * Constructs a list containing the elements of the specified
- * collection, in the order they are returned by the collection's
- * iterator. The <tt>ArrayList</tt> instance has an initial capacity of
- * 110% the size of the specified collection.
- *
- * @param c the collection whose elements are to be placed into this list.
- * @throws NullPointerException if the specified collection is null.
- */
- public Bar(Collection<? extends E> c) {
- size = c.size();
- // Allow 10% room for growth
- elementData = (E[])new Object[
- (int)Math.min((size*110L)/100,Integer.MAX_VALUE)];
- c.toArray(elementData);
- }
-
- /**
- * Trims the capacity of this <tt>ArrayList</tt> instance to be the
- * list's current size. An application can use this operation to minimize
- * the storage of an <tt>ArrayList</tt> instance.
- */
- public void trimToSize() {
- modCount++;
- int oldCapacity = elementData.length;
- if (size < oldCapacity) {
- Object oldData[] = elementData;
- elementData = (E[])new Object[size];
- System.arraycopy(oldData, 0, elementData, 0, size);
- }
- }
-
- /**
- * Increases the capacity of this <tt>ArrayList</tt> instance, if
- * necessary, to ensure that it can hold at least the number of elements
- * specified by the minimum capacity argument.
- *
- * @param minCapacity the desired minimum capacity.
- */
- public void ensureCapacity(int minCapacity) {
- modCount++;
- int oldCapacity = elementData.length;
- if (minCapacity > oldCapacity) {
- Object oldData[] = elementData;
- int newCapacity = (oldCapacity * 3)/2 + 1;
- if (newCapacity < minCapacity)
- newCapacity = minCapacity;
- elementData = (E[])new Object[newCapacity];
- System.arraycopy(oldData, 0, elementData, 0, size);
- }
- }
-
- /**
- * Returns the number of elements in this list.
- *
- * @return the number of elements in this list.
- */
- public int size() {
- return size;
- }
-
- /**
- * Tests if this list has no elements.
- *
- * @return <tt>true</tt> if this list has no elements;
- * <tt>false</tt> otherwise.
- */
- public boolean isEmpty() {
- return size == 0;
- }
-
- /**
- * Returns <tt>true</tt> if this list contains the specified element.
- *
- * @param elem element whose presence in this List is to be tested.
- * @return <code>true</code> if the specified element is present;
- * <code>false</code> otherwise.
- */
- public boolean contains(Object elem) {
- return indexOf(elem) >= 0;
- }
-
- /**
- * Searches for the first occurence of the given argument, testing
- * for equality using the <tt>equals</tt> method.
- *
- * @param elem an object.
- * @return the index of the first occurrence of the argument in this
- * list; returns <tt>-1</tt> if the object is not found.
- * @see Object#equals(Object)
- */
- public int indexOf(Object elem) {
- if (elem == null) {
- for (int i = 0; i < size; i++)
- if (elementData[i]==null)
- return i;
- } else {
- for (int i = 0; i < size; i++)
- if (elem.equals(elementData[i]))
- return i;
- }
- return -1;
- }
-
- /**
- * Returns the index of the last occurrence of the specified object in
- * this list.
- *
- * @param elem the desired element.
- * @return the index of the last occurrence of the specified object in
- * this list; returns -1 if the object is not found.
- */
- public int lastIndexOf(Object elem) {
- if (elem == null) {
- for (int i = size-1; i >= 0; i--)
- if (elementData[i]==null)
- return i;
- } else {
- for (int i = size-1; i >= 0; i--)
- if (elem.equals(elementData[i]))
- return i;
- }
- return -1;
- }
-
- /**
- * Returns a shallow copy of this <tt>ArrayList</tt> instance. (The
- * elements themselves are not copied.)
- *
- * @return a clone of this <tt>ArrayList</tt> instance.
- */
- public Object clone() {
- try {
- Bar<E> v = (Bar<E>) super.clone();
- v.elementData = (E[])new Object[size];
- System.arraycopy(elementData, 0, v.elementData, 0, size);
- v.modCount = 0;
- return v;
- } catch (CloneNotSupportedException e) {
- // this shouldn't happen, since we are Cloneable
- throw new InternalError();
- }
- }
-
- /**
- * Returns an array containing all of the elements in this list
- * in the correct order.
- *
- * @return an array containing all of the elements in this list
- * in the correct order.
- */
- public Object[] toArray() {
- Object[] result = new Object[size];
- System.arraycopy(elementData, 0, result, 0, size);
- return result;
- }
-
- /**
- * Returns an array containing all of the elements in this list in the
- * correct order; the runtime type of the returned array is that of the
- * specified array. If the list fits in the specified array, it is
- * returned therein. Otherwise, a new array is allocated with the runtime
- * type of the specified array and the size of this list.<p>
- *
- * If the list fits in the specified array with room to spare (i.e., the
- * array has more elements than the list), the element in the array
- * immediately following the end of the collection is set to
- * <tt>null</tt>. This is useful in determining the length of the list
- * <i>only</i> if the caller knows that the list does not contain any
- * <tt>null</tt> elements.
- *
- * @param a the array into which the elements of the list are to
- * be stored, if it is big enough; otherwise, a new array of the
- * same runtime type is allocated for this purpose.
- * @return an array containing the elements of the list.
- * @throws ArrayStoreException if the runtime type of a is not a supertype
- * of the runtime type of every element in this list.
- */
- public <T> T[] toArray(T[] a) {
- if (a.length < size)
- a = (T[])java.lang.reflect.Array.
- newInstance(a.getClass().getComponentType(), size);
- System.arraycopy(elementData, 0, a, 0, size);
- if (a.length > size)
- a[size] = null;
- return a;
- }
-
- // Positional Access Operations
-
- /**
- * Returns the element at the specified position in this list.
- *
- * @param index index of element to return.
- * @return the element at the specified position in this list.
- * @throws IndexOutOfBoundsException if index is out of range <tt>(index
- * &lt; 0 || index &gt;= size())</tt>.
- */
- public E get(int index) {
- RangeCheck(index);
-
- return elementData[index];
- }
-
- /**
- * Replaces the element at the specified position in this list with
- * the specified element.
- *
- * @param index index of element to replace.
- * @param element element to be stored at the specified position.
- * @return the element previously at the specified position.
- * @throws IndexOutOfBoundsException if index out of range
- * <tt>(index &lt; 0 || index &gt;= size())</tt>.
- */
- public E set(int index, E element) {
- RangeCheck(index);
-
- E oldValue = elementData[index];
- elementData[index] = element;
- return oldValue;
- }
-
- /**
- * Appends the specified element to the end of this list.
- *
- * @param o element to be appended to this list.
- * @return <tt>true</tt> (as per the general contract of Collection.add).
- */
- public boolean add(E o) {
- ensureCapacity(size + 1); // Increments modCount!!
- elementData[size++] = o;
- return true;
- }
-
- /**
- * Inserts the specified element at the specified position in this
- * list. Shifts the element currently at that position (if any) and
- * any subsequent elements to the right (adds one to their indices).
- *
- * @param index index at which the specified element is to be inserted.
- * @param element element to be inserted.
- * @throws IndexOutOfBoundsException if index is out of range
- * <tt>(index &lt; 0 || index &gt; size())</tt>.
- */
- public void add(int index, E element) {
- if (index > size || index < 0)
- throw new IndexOutOfBoundsException(
- "Index: "+index+", Size: "+size);
-
- ensureCapacity(size+1); // Increments modCount!!
- System.arraycopy(elementData, index, elementData, index + 1,
- size - index);
- elementData[index] = element;
- size++;
- }
-
- /**
- * Removes the element at the specified position in this list.
- * Shifts any subsequent elements to the left (subtracts one from their
- * indices).
- *
- * @param index the index of the element to removed.
- * @return the element that was removed from the list.
- * @throws IndexOutOfBoundsException if index out of range <tt>(index
- * &lt; 0 || index &gt;= size())</tt>.
- */
- public E remove(int index) {
- RangeCheck(index);
-
- modCount++;
- E oldValue = elementData[index];
-
- int numMoved = size - index - 1;
- if (numMoved > 0)
- System.arraycopy(elementData, index+1, elementData, index,
- numMoved);
- elementData[--size] = null; // Let gc do its work
-
- return oldValue;
- }
-
- /**
- * Removes a single instance of the specified element from this
- * list, if it is present (optional operation). More formally,
- * removes an element <tt>e</tt> such that <tt>(o==null ? e==null :
- * o.equals(e))</tt>, if the list contains one or more such
- * elements. Returns <tt>true</tt> if the list contained the
- * specified element (or equivalently, if the list changed as a
- * result of the call).<p>
- *
- * @param o element to be removed from this list, if present.
- * @return <tt>true</tt> if the list contained the specified element.
- */
- public boolean remove(Object o) {
- if (o == null) {
- for (int index = 0; index < size; index++)
- if (elementData[index] == null) {
- fastRemove(index);
- return true;
- }
- } else {
- for (int index = 0; index < size; index++)
- if (o.equals(elementData[index])) {
- fastRemove(index);
- return true;
- }
- }
- return false;
- }
-
- /*
- * Private remove method that skips bounds checking and does not
- * return the value removed.
- */
- private void fastRemove(int index) {
- modCount++;
- int numMoved = size - index - 1;
- if (numMoved > 0)
- System.arraycopy(elementData, index+1, elementData, index,
- numMoved);
- elementData[--size] = null; // Let gc do its work
- }
-
- /**
- * Removes all of the elements from this list. The list will
- * be empty after this call returns.
- */
- public void clear() {
- modCount++;
-
- // Let gc do its work
- for (int i = 0; i < size; i++)
- elementData[i] = null;
-
- size = 0;
- }
-
- /**
- * Appends all of the elements in the specified Collection to the end of
- * this list, in the order that they are returned by the
- * specified Collection's Iterator. The behavior of this operation is
- * undefined if the specified Collection is modified while the operation
- * is in progress. (This implies that the behavior of this call is
- * undefined if the specified Collection is this list, and this
- * list is nonempty.)
- *
- * @param c the elements to be inserted into this list.
- * @return <tt>true</tt> if this list changed as a result of the call.
- * @throws NullPointerException if the specified collection is null.
- */
- public boolean addAll(Collection<? extends E> c) {
- Object[] a = c.toArray();
- int numNew = a.length;
- ensureCapacity(size + numNew); // Increments modCount
- System.arraycopy(a, 0, elementData, size, numNew);
- size += numNew;
- return numNew != 0;
- }
-
- /**
- * Inserts all of the elements in the specified Collection into this
- * list, starting at the specified position. Shifts the element
- * currently at that position (if any) and any subsequent elements to
- * the right (increases their indices). The new elements will appear
- * in the list in the order that they are returned by the
- * specified Collection's iterator.
- *
- * @param index index at which to insert first element
- * from the specified collection.
- * @param c elements to be inserted into this list.
- * @return <tt>true</tt> if this list changed as a result of the call.
- * @throws IndexOutOfBoundsException if index out of range <tt>(index
- * &lt; 0 || index &gt; size())</tt>.
- * @throws NullPointerException if the specified Collection is null.
- */
- public boolean addAll(int index, Collection<? extends E> c) {
- if (index > size || index < 0)
- throw new IndexOutOfBoundsException(
- "Index: " + index + ", Size: " + size);
-
- Object[] a = c.toArray();
- int numNew = a.length;
- ensureCapacity(size + numNew); // Increments modCount
-
- int numMoved = size - index;
- if (numMoved > 0)
- System.arraycopy(elementData, index, elementData, index + numNew,
- numMoved);
-
- System.arraycopy(a, 0, elementData, index, numNew);
- size += numNew;
- return numNew != 0;
- }
-
- /**
- * Removes from this List all of the elements whose index is between
- * fromIndex, inclusive and toIndex, exclusive. Shifts any succeeding
- * elements to the left (reduces their index).
- * This call shortens the list by <tt>(toIndex - fromIndex)</tt> elements.
- * (If <tt>toIndex==fromIndex</tt>, this operation has no effect.)
- *
- * @param fromIndex index of first element to be removed.
- * @param toIndex index after last element to be removed.
- */
- protected void removeRange(int fromIndex, int toIndex) {
- modCount++;
- int numMoved = size - toIndex;
- System.arraycopy(elementData, toIndex, elementData, fromIndex,
- numMoved);
-
- // Let gc do its work
- int newSize = size - (toIndex-fromIndex);
- while (size != newSize)
- elementData[--size] = null;
- }
-
- /**
- * Check if the given index is in range. If not, throw an appropriate
- * runtime exception. This method does *not* check if the index is
- * negative: It is always used immediately prior to an array access,
- * which throws an ArrayIndexOutOfBoundsException if index is negative.
- */
- private void RangeCheck(int index) {
- if (index >= size)
- throw new IndexOutOfBoundsException(
- "Index: "+index+", Size: "+size);
- }
-
- /**
- * Save the state of the <tt>ArrayList</tt> instance to a stream (that
- * is, serialize it).
- *
- * @serialData The length of the array backing the <tt>ArrayList</tt>
- * instance is emitted (int), followed by all of its elements
- * (each an <tt>Object</tt>) in the proper order.
- */
- private void writeObject(java.io.ObjectOutputStream s)
- throws java.io.IOException{
- // Write out element count, and any hidden stuff
- s.defaultWriteObject();
-
- // Write out array length
- s.writeInt(elementData.length);
-
- // Write out all elements in the proper order.
- for (int i=0; i<size; i++)
- s.writeObject(elementData[i]);
- }
-
- /**
- * Reconstitute the <tt>ArrayList</tt> instance from a stream (that is,
- * deserialize it).
- */
- private void readObject(java.io.ObjectInputStream s)
- throws java.io.IOException, ClassNotFoundException {
- // Read in size, and any hidden stuff
- s.defaultReadObject();
-
- // Read in array length and allocate array
- int arrayLength = s.readInt();
- Object[] a = elementData = (E[])new Object[arrayLength];
-
- // Read in all elements in the proper order.
- for (int i=0; i<size; i++)
- a[i] = s.readObject();
- }
-}
7 testdata/refactoring/copyClass/multifile/packageHierarchy/after/p1/S1.java
View
@@ -1,7 +0,0 @@
-package p1;
-public class S1 {
- S2 s2;
- void foo() {
- s2.foo();
- }
-}
7 testdata/refactoring/copyClass/multifile/packageHierarchy/after/p1/S2.java
View
@@ -1,7 +0,0 @@
-package p1;
-public class S2 {
- S1 s1;
- void foo() {
- s1.foo();
- }
-}
2  testdata/refactoring/copyClass/multifile/packageHierarchy/after/p1/p11/S11.java
View
@@ -1,2 +0,0 @@
-package p1.p11;