TS 60 Refactoring

Refactoring Test Specification for

Author: Max Sauer, Jiri Prox
Version: 6.1
Last update: 2008/03/04
Introduction: This document contains usual/typical scenarios that can be encountered by user which want to test a refactoring functionality included in the NetBeans IDE.
Comments:

Contents


Test suite: Find Usages

Purpose: To verify if this part of refactoring functionality corresponds with design and works right.
Setup: These steps are required to be possible to go through following part of the test specification.

  • Unzip a project default from default_STS_68_Refactoring.zip to some work directory.
  • Start IDE with a clean userdir.
  • Invoke File | Open Project... action.
  • Select unzipped projects default.
  • Scanning structure of project should be performed (It takes a while).


  1. Class - Usages
    1. Select org.netbeans.tests.examples.packa.Bean class in the Projects view.
    2. Invoke Find Usages action from the popup menu.
    3. Select Find Usages choice and in the Find Usages ... dialog and confirm it by the Find button.
    • EXPECTED RESULT: Usages of org.netbeans.tests.examples.packa.Bean (33 occurences) should be displayed in the first line of Usages window
    • 35 occurrences are found if 'Search in Comments' is checked.
  2. Class - All Subtypes
    1. Select org.netbeans.tests.examples.packa.Bean class in the Project view.
    2. Invoke Find Usages action from the popup menu.
    3. Select Find All Subtypes choice and Search in Comments checkbox in the Find Usages ... dialog and confirm it by the Find button.
    • EXPECTED RESULT: Usages of org.netbeans.tests.examples.packa.Bean (8 occurences)
      should be displayed in the first line of Usages window.
  3. Class - Direct Subtypes
    1. Select org.netbeans.tests.examples.packa.Bean class in the Project view.
    2. Invoke Find Usages action from the popup menu.
    3. Select Find Direct Subtypes Only choice and Search in Comments checkbox in the Find Usages ... dialog and confirm it by the Find button.
    • EXPECTED RESULT: Usages of org.netbeans.tests.examples.packa.Bean (2 occurences)
      should be displayed in the first line of Usages window
  4. Interface - Usages
    1. Select org.netbeans.tests.examples.packc.Makable class in the Project view
    2. Invoke Find Usages action from the popup menu
    3. Select Find Usages choice in the Find Usages ... dialog and confirm it by the Find button.
    • EXPECTED RESULT: Usages of org.netbeans.tests.examples.packc.Makable (17 occurences)
      should be displayed in the first line of Usages window
    • 18 occurences are found if 'Search in Comments' is checked
  5. Interface - All Subtypes
    1. Select org.netbeans.tests.examples.packc. Makable class in the Project view
    2. Invoke Find Usages action from the popup menu
    3. Select Find All Subtypes choice and Search in Comments checkbox in the Find Usages ... dialog and confirm it by the Find button.
    • EXPECTED RESULT: Usages of org.netbeans.tests.examples.packc.Makable (7 occurences)
      should be displayed in the first line of Usages window
  6. Interface - Direct Subtypes
    1. Select org.netbeans.tests.examples.packc.Makable class in the Project view
    2. Invoke Find Usages action from the popup menu
    3. Select Find Direct Subtypes Only choice and Search in Comments checkbox in the Find Usages ... dialog and confirm it by the Find button.
    • EXPECTED RESULT: Usages of org.netbeans.tests.examples.packc.Makable (3 occurences)
      should be displayed in the first line of Usages window
  7. Constructor
    1. Put caret on constructor BeanB() in the org.netbeans.tests.examples.packb.BeanB class
    2. Invoke Find Usages action from the popup menu
    3. Select Search in Comments check box in Find Usages dialog and press Find button.
    • EXPECTED RESULT: <Usages of org.netbeans.tests.examples.packb.BeanB (5 occurences)
      should be displayed in the first line of Usages window
  8. Method - Usages
    1. Put caret over make(int, String, Bean) method in the org.netbeans.tests.examples.packc.Makable class
    2. Invoke Find Usages action from the popup menu
    3. Select only Find Usages checkbox and Search in Comments checkbox in the Find Usages... dialog and confirm it by Find button.
    • EXPECTED RESULT: Usages of Makable.make (4 occurences)
      should be displayed in the first line of Usages window.
  9. Method - Overriding Methods
    1. Put caret over make(int, String, Bean) in the org.netbeans.tests.examples.packc.Makable class
    2. Invoke Find Usages action from the popup menu
    3. Select only Find Overriding Methods checkbox and Search in Comments checkbox in the Find Usages... dialog and confirm it by Find button.
    • EXPECTED RESULT: Overriding Methods of Makable.make (5 occurences)
      should be displayed in the first line of Usages window.
  10. Method - Search from Base Class
    1. Put caret over make(int, String, Bean) in the org.netbeans.tests.examples.packb.BeanB class
    2. Invoke Find Usages action from the popup menu
    3. Select only Find Usages, Search from Base Class and Search in Comments checkboxies in the Find Usages... dialog and confirm it by Next button.
    • EXPECTED RESULT: Usages of Makable.make (4 occurences)
      should be displayed in the first line of Usages window.
  11. Field
    1. Put caret over refID in the org.netbeans.tests.examples.packa.Bean class
    2. Invoke Find Usages action from the popup menu
    3. Select Search In comments checkbox and confirm dialog by Find button.
    • EXPECTED RESULT: Usages of refID (16 occurences)
      should be displayed in the first line of Usages window.
    • EXPECTED RESULT: 13 occurrences are found if Search In comments is unselected.
  12. Java Class - String
    1. Open org.netbeans.tests.examples.packc.Makable
    2. Put caret over String in declaration of method make(...)
    3. Invoke Find Usages action from the popup menu.
    4. Select Find Usages radio button and check that scope is set only to project default, confirm it by Find button.
    • EXPECTED RESULT: Usages of java.lang.String (39 occurences)
      should be displayed in the first line of Usages window.
  13. Java Class - scope
    1. Open at least one another project
    2. Open org.netbeans.tests.examples.packc.Makable
    3. Put caret over String in declaration of method make(...)
    4. Invoke Find Usages action from the popup menu.
    5. Select Find Usages radio button and check that scope is set only to all opened preject, confirm it by Find button.
    • EXPECTED RESULT: Usages of class String are found in all opened projects.


Test suite: Rename

Purpose: To verify if this part of refactoring functionality corresponds with design and works right.
Setup: These steps are required to be possible to go through following part of the test specification.

  • Unzip a project default from default_TS_60_Refactoring.zip to some work directory.
  • Start IDE with a clean userdir
  • Invoke File | Open Project... action
  • Select unzipped projects default
  • Scanning structure of project should be performed (It takes a while)

After each testcase use Undo from the Refactor menu to get sources to original state or perform opposite refactoring (e.g. rename it back). Try to clean & build project after each refactoring, there should not be any compilation error, unless it is explicitly written in this test specification. The number of occurrences can differ, the significant is that the application in compilable and its behavior is not changed.

  1. Package
    1. Select org.netbeans.tests.examples.packa package node in the Project view
    2. Invoke Refactoring | Rename action from the popup menu
    3. Fill a new package name org.netbeans.tests.examples.packarenamed in the Rename dialog, confirm this dialog by Preview button.
    4. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: Rename org.netbeans.tests.examples.packa to org.netbeans.tests.examples.packarenamed (23 occurences)
      should be displayed in Refactoring window. After Do Refactoring action should be project compilable.
  1. Package in Files view
    1. Switch to the Files tab
    2. Select default/src/org package node in the Files view
    3. Click to the node to activate its inplace rename
    4. Fill a new package name com and confirm by enter key
    5. The Rename org dialog should be displayed. Confirm by Preview button.
    6. Press Do Refactoring button and changes will be performed.
    • EXPECTED RESULT: Rename org to com (51 occurences)
      should be displayed in Refactoring window. After Do Refactoring action should be project compilable.
  1. Class
    1. Select org.netbeans.tests.examples.packa.Bean class node in the Project view
    2. Invoke Refactoring | Rename action from the popup menu
    3. Fill a new class name BeanRenamed and confirm it by Preview button
    4. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: Rename Bean to BeanRenamed (36 occurences)
      should be displayed in Refactoring window. After Do Refactoring action should be project compilable. 38 occurrences are updated if 'Apply rename on comments' is selected
  1. Class - non-primary top level
    1. Put caret ower name in declaration of org.netbeans.tests.examples.packb.BeansD.BeanD class
    2. Invoke Refactoring | Rename action from the popup menu
    3. Fill a new class name BeanDRenamed and confirm it by Preview button
    4. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: Rename BeanD to BeanDRenamed (5 occurences)
      should be displayed in Refactoring window. After Do Refactoring action should be project compilable.
  1. Class - inline
    1. Select org.netbeans.tests.examples.packa.Bean class node in the Project view
    2. Click to the node to activate its inplace rename
    3. Fill a new class name BeanRenamed and confirm by enter key
    4. The rename dialog should be displayed. Confirm the dialog by Preview button
    5. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: Rename Bean to BeanRenamed (36 occurences)
      should be displayed in Refactoring window. After Do Refactoring action should be project compilable.
  1. Interface
    1. Select org.netbeans.tests.examples.packc.Makable interface node in the Project view
    2. Invoke Refactoring | Rename action from the popup menu
    3. Fill a new interface name MakableRenamed and confirm this dialog by Preview button
    4. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: Rename Makable to MakableRenamed (19 occurences)
      should be displayed in Refactoring window. After Do Refactoring action should be project compilable. 20 occurrences are updated if 'Apply rename on comments' is selected
  1. Rename Method
    1. Put caret over getProtectedProperty() of the org.netbeans.tests.examples.packb.BeanA class
    2. Invoke Refactoring | Rename action from the popup menu
    3. There should be displayed warning: There are methods in subclasses/implementors of org.netbeans.tests.examples.packb.BeanA that override or implement this method. They will also be renamed.
    4. Press Next button
    5. Fill a new method name getProtectedPropertyRenamed and confirm this dialog
    6. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: Rename getProtectedProperty to getProtectedPropertyRenamed (14 occurences)
      should be displayed in Refactoring window. After Do Refactoring action should be project compilable.
  1. Rename Field
    1. Put caret on field protectedProperty of the org.netbeans.tests.examples.packb.BeanA class in the Project view
    2. Invoke Refactoring | Rename action from the popup menu
    3. Fill a new field name protectedPropertyRenamed and confirm this dialog
    4. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: Rename protectedProperty to protectedPropertyRenamed (19 occurences)
      should be displayed in Refactoring window. After Do Refactoring action should be project compilable. 24 occurrences are updated if 'Apply rename on comments' is selected
  1. Rename Local Field
    1. Open class org.netbeans.tests.examples.packc.BeanE in the source editor.
    2. Move cursor to attribute v1 of the method public double count(double[[ | ]] v1, double[[ | ]] v2) .
    3. Invoke Refactoring | Rename action from the popup menu
    4. Fill a new field name vector1 and and confirm this dialog
    5. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: Rename v1 to vector1 (9 occurences)
      should be displayed in Refactoring window. After Do Refactoring action should be project compilable.


Test suite: Move Class

Purpose: To verify if this part of refactoring functionality corresponds to design and works right.
Setup: These steps are required to be possible to go through following part of the test specification.

  • Unzip a project default from default_TS_60_Refactoring.zip to some work directory.
  • Start IDE with a clean userdir
  • Invoke File | Open Project... action
  • Select unzipped projects default
  • Scanning structure of project should be performed (It takes a while)

After each refactoring is performed, call Undo from refactoring menu to get sources to original state. Check that Undo is performed correctly

  1. Move class
    1. Select org.netbeans.tests.examples.packa.Bean class in the Project view
    2. Invoke Refactoring | Move Class ... action from the popup menu
    3. Select org.netbeans.tests.examples.packb in To Package combobox and confirm it by Preview button.
    4. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: Move class Bean to org/netbeans/tests/examples/packb package (15 occurences)
      should be displayed in Refactoring
  1. Package private field
    1. Select org.netbeans.tests.examples.packb.BeanA class in the Project view
    2. Invoke Refactoring | Move Class ... action from the popup menu
    3. Problem: Class "BeanB" within the same package is using protected field "protectedProperty" of class you want to move ("BeanA"). should be displayed. Continue by Next button.
    4. Select org.netbeans.tests.examples.packa in To Package combobox and and confirm it by Preview button.
    5. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: Move class org.netbeans.tests.examples.packb.BeanA to org/netbeans/tests/examples/packa package (6 occurences)
      should be displayed in Refactoring
  1. Default package
    1. Select org.netbeans.tests.examples.packb.BeanB class in the Project view
    2. Invoke Refactoring | Move Class ... action from the popup menu
    3. Problem: Class you want to move ("BeanB") is using protected field "protectedProperty" of class "BeanA" within the same package. should be displayed. Continue by Next button.
    4. Select <default package> in To Package combobox and select Preview All Changes checkbox in the Move Class dialog and confirm it by Next button.
    5. Problem: If the class is moved to the default package, classes in other packages will not be able to import the moved class. should be displayed. Continue by Next button.
    6. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: Move class org.netbeans.tests.examples.packb.BeanB to <default> package (2 occurrences)
      should be displayed in Refactoring
  1. Drag and Drop
    1. Select AbstractBean and Makable in the org.netbaens.tests.examples.packc , drag them and drop into org.netbeans.tests.examples.packa .
    2. Move dialog will be displayed. List of Classes list contains both selected classes. Confirm dialog by the Preview button.
    3. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: Move Classes (16 occurrences)
      should be displayed in Refactoring window. After Do Refactoring project will be compilable.
  1. To Test Packages
    1. Switch to Files view and add test/org/netbeans/tests folder into root folder of default project.
    2. Select org.netbeans.tests.examples.packc.BeanE class in Source Packages in Projects view.
    3. Invoke Refactoring | Move ... action from the popup menu
    4. Select Test Packages in Location combobox, select org.netbeans.tests in To Package combobox and confirm it by Preview button.
    5. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: Move class org.netbeans.tests.examples.packc.BeanE to org/netbeans/tests package (2 occurrences)
      should be displayed in Refactoring


Test suite: Change Method Parameters

Purpose: To verify if this part of refactoring functionality corresponds to design and works right
Setup: These steps are required to be possible to go through following part of the test specification.

  • Unzip a project default from default_TS_60_Refactoring.zip to some work directory.
  • Start IDE with a clean userdir
  • Invoke File | Open Project... action
  • Select unzipped projects default
  • Scanning structure of project should be performed (It takes a while)

  1. Constructor
    1. Put caret over constructor BeanA() from the org.netbeans.tests.examples.packb.BeanA class
    2. Invoke Refactoring | Change Method Parameters action from the popup menu
    3. In the Change Method Parameters dialog press the Add button and fill Name, Type and Default Value for new created parameter as name , java.lang.String and "" .
    4. press Preview button.
    5. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: Change parameters of BeanA constructor to public BeanA(String name) (4 occurences)
      should be displayed on the first line of Refactoring
  1. Add parameter
    1. Put caret over method abc() from the org.netbeans.tests.examples.packa.Bean class.
    2. Invoke Refactoring | Change Method Parameters action from the popup menu
    3. In the Change Method Parameters dialog press the Add button and fill Name and Type for the new created parameter as id and int . Leave Default Value field empty.
    4. There should be displayed an error notice "Error: You have to provide default values for all new parameters." Fill Default Value as 0 .
    5. Press Preview button.
    6. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: Change parameters of abc method to public org.netbeans.tests.examples.packa.Bean abc(int id) (12 occurrences)
      should be displayed on the first line of Refactoring
  1. Remove parameter
    1. Select method make(int index, String s, Bean bean) from the org.netbeans.tests.examples.packc.Makable class.
    2. Invoke Refactoring | Change Method Parameters action from the popup menu
    3. In the Change Method Parameters dialog select "bean" parameter and press the Remove button.
    4. Notice that Access Modifier combobox is disabled for interfaces.
    5. Press Preview button.
    6. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: Change parameters of make method to public abstract void make(int index, java.lang.String s) (10 occurrences)
      should be displayed on the first line of Refactoring
  1. Visibility Modifier
    1. Put caret over abc() from the org.netbeans.tests.examples.packa.Bean class.
    2. Invoke Refactoring | Change Method Parameters action from the popup menu
    3. In the Change Method Parameters dialog select protected in the Access Modifier checkbox.
    4. Press Preview button.
    5. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: Change parameters of abc method to protected org.netbeans.tests.examples.packa.Bean abc() (4 occurrences)
      should be displayed on the first line of Refactoring
  1. Parameter position
    1. Put caret over make(int index, String s, Bean bean) in the org.netbeans.tests.examples.packc.Makable class.
    2. Invoke Refactoring | Change Method Parameters action from the popup menu
    3. In the Change Method Parameters dialog select "s" parameter and press the Move Up button.
    4. Press Preview button.
    5. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: All method call are updated, project is compilable. (24 occurrences)
  1. Vararg
    1. Put caret over make(int index, String s, Bean bean) in the org.netbeans.tests.examples.packc.Makable class.
    2. Invoke Refactoring | Change Method Parameters action from the popup menu
    3. Add new argument of type int...
    4. Try to move it to the different position than last
    5. Enter 1,2,3 as default value
    6. Perform refactoring
    • EXPECTED RESULT: The refactoring cannot continue if vararg parameter is not at the last position. If refactoring is performed method declaration is modified as expected and provided default values are added to all calls of refactored method (Note you have to set project source level to 1.5) (10 occurrences)


Test suite: Encapsulate Fields

Purpose: To verify if this part of refactoring functionality corresponds to design and works right
Setup: These steps are required to be possible to go through following part of the test specification.

  • Unzip a project Encapsulate from encapsulate_TS_60_Refactoring.zip to some work directory.
  • Invoke File | Open Project... action
  • Select unzipped project
  • Scanning structure of project should be performed (It takes a while)

  1. Encapsulate field
    1. Put caret over field field from the MainClass .
    2. Invoke Refactoring | Encapsulate Fields action from the popup menu
    3. Select creating getter and setter, press Preview button.
    4. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: The getter/setter are generated, modifier of the field is changed to desired value (private by default) and all usages are replaced by calls of getter or setters
  1. Change getter, setter name, modifier
    1. Put caret over field field from the MainClass .
    2. Invoke Refactoring | Encapsulate Fields action from the popup menu.
    3. Change getter/setter name and its modifier
    4. Press Preview button.
    5. If you agree with these changes press Do Refactoring button and changes will be performed
    • EXPECTED RESULT: The getter/setter has correct name and the modifiers are as specified in dialog.
  1. Use Accessors if needed
    1. Call Encapsulate field on field x in class Access
    2. Change visibility modifier to protected
    3. Uncheck Use accessors even when field is visible checkbox
    4. Press Preview and inspect proposed changeds
    5. Preform refactoring
    • EXPECTED RESULT: Getter and setter are generated, visibility modifier is changed. Accessors are used only in class AccessB
  1. Usage in constructor
    1. Call Encapsulate field on field y in class Ctor
    2. Set visibility modifier to private, accessors visibility to public, select "Use accessors even when field is visible"
    3. Perform refactoring
    • EXPECTED RESULT: Warning about usage in constructor is displayed
  1. Nothing to encapsulate
    1. Call Encapsulate field in class EmptyClass
    • EXPECTED RESULT: Dialog stating that EmptyClass has no fields is shown
  1. Existing methods
    1. Call Encapsulate field on field a in class ExMethod
    2. Keep defaults name
    3. Perform refactoring
    • EXPECTED RESULT: The modifier are not changed, since they already exists


Test suite: Miscellaneous

Purpose: To verify if this part of refactoring functionality corresponds to design and works right
Setup: These steps are required to be possible to go through following part of the test specification.

  • Unzip a project default from default_TS_60_Refactoring.zip to some work directory.
  • Start IDE with a clean userdir
  • Invoke File | Open Project... action
  • Select unzipped projects default
  • Scanning structure of project should be performed (It takes a while)

  1. Undo/Redo
    1. Perform some previous testcase (rename, ...) and invoke Undo action
    2. Verify if changes were reverted to the initial state }}
    3. Invoke Redo action
    4. Verify if changes were same like after refactoring }}
    • EXPECTED RESULT: Verification was performed during testcase
  1. Same name in two projects
    1. Create a new General | Java Application project called JavaApplication1; with a main class Main in the package abc.
    2. Create a another new General | Java Application project called JavaApplication2; with a main class Main in the package abc.
    3. Create a new class Alfa in the package abc for JavaApplication1 project
    4. Create a new class Beta in the package abc for JavaApplication2 project
    5. Invoke Refactoring | Rename action from the popup menu for the abc.Beta in the JavaApplication2 project
    6. Fill a new class name Alfa in the Rename dialog and confirm this dialog
    • EXPECTED RESULT: Class Beta from JavaApplication2 project should be renamed to Alfa.
  1. Preview window
    1. Open preview for refactoring (any of the earlier described testcases)
    2. Try function of the buttons in the left part
    3. Click on some item in the tree
    4. Double click on some item in the tree
    • EXPECTED RESULT: The buttons in the right has following functions
    • Refresh refactoring data - brings back refactoring dialog, the values in the should in the state as they were when button Preview was pressed
    • Expand/Collapse all Node - expands/collapses the tree of refactoring preview
    • Show logical view - changes refactoring tree to show hierarchical package structure
    • Show physical view - the tree shows only project and files where the changes will be performed
    • Previous Occurrence, Next Occurrence - jumps to previous/next node in the refactoring tree
    • Click on item opens and or set the preview to show related change (if available)
    • Double click shows related position in the main editor
  1. Preview window - shortcut
    1. Open preview for refactoring (any of the earlier described testcases)
    2. Try shortcuts Ctrl-comma, Ctrl-period
    • EXPECTED RESULT: The caret jump on next/previous item in result as when clicking on arrow button in left panel
  1. Customize refactoring
    1. Open preview for any rename refactoring
    2. Uncheck several refactoring elements in the refactoring tree
    3. Perform refactoring
    • EXPECTED RESULT: The unselected changes are not performed - not shown in preview and not performed in the code itself
  1. Concurrent modification
    1. Call Rename refactoring on class org.netbeans.tests.examples.packa.Bean
    2. Enter new name and press button Preview
    3. While preview is opened change significantly class Bean (e.g. add several new lines)
    • EXPECTED RESULT: The preview shows gray label Rename ..... NEEDS REFRESH and the Do Refactoring button is disabled
  1. Find usages window
    1. Close 'Usages' window
    2. Go to Window -> Output -> Find Usages Results
    • EXPECTED RESULT: The empty window 'Usages' is opened in output area
  1. Refactoring preview window
    1. Close 'Refactoring' window
    2. Go to Window -> Output -> Refactoring Preview
    • EXPECTED RESULT: The empty window 'Refactoring' is opened in output area


  1. Refactoring preview window - panels
    1. Perform several find usages in a row
    2. Right click on tab in 'Usages' window
    3. Try 'Close Tab', 'Close All', 'Close Others Tabs' actions
    • EXPECTED RESULT: The required tabs are closed


Test suite: JDK 1.5 Refactoring

Purpose: This test suite tests overall refactoring on JDK1.5 sources.
Setup: These steps are required to be possible to go through following part of the test specification.

  • Unzip a project default2 from default15_TS_60_Refactoring.zip to some work directory.
  • Start IDE with a clean userdir and JDK >= 1.5
  • Invoke File | Open Project... action
  • Select unzipped projects default2
  • Scanning structure of project should be performed (It takes a while)

  1. Refactoring 1.5 - Find Usages
    1. Open package abc .
    2. Find usages of class abc.A .
    • EXPECTED RESULT: Usages of the A should be found. 17 occurrences if 'Search in comments' is unchecked, 22 otherwise.
  1. Refactoring 1.5 - Find Usages - Context
    1. Open annotation abc.def.DAnnotType in the editor and select X of En in default value of member coord in source text.
    2. Invoke the context menu and choose Find Usages .
    3. Find Usages dialog should contain title: "Finx X of class En":.
    4. Select Search in Comments checkbox.
    5. Invoke dialog by Next button.
    • EXPECTED RESULT: It should find 4 occurences of En.X constant.
  1. Refactoring 1.5 - Rename Class
    1. Open class abc.A in the editor.
    2. Find node correspoding to class abc.A in the explorer (projects view).
    3. Invoke the context menu and choose Refactor/Rename... .
    4. Change name to TestClassName .
    • EXPECTED RESULT: Verify that the result is correct - the project is compilable and the class was renamed. 27 (22 is not renaming in comments) occurrences are found and updated.
  1. Refactoring 1.5 - Rename Generics
    1. Open class abc.A in the editor.
    2. Put cursor over T in the class declaration
    3. Invoke the context menu and choose Refactor/Rename... .
    4. Change name to X .
    • EXPECTED RESULT: Verify that the result is correct (the project is compilable and the identifier was renamed).
  1. Refactoring 1.5 - Rename Enumeration
    1. Open enumeration abc.En in the editor.
    2. Find node correspoding to enumeration abc.En in the explorer (projects view).
    3. Invoke the context menu and choose Refactor/Rename... .
    4. Change name to TestEnumeration .
    • EXPECTED RESULT: Verify that the result is correct (the project is compilable and the enumeration was renamed). 25 (22 - if not renaming in commantes) occurrences were updated
  1. Refactoring 1.5 - Rename Enumeration Constant
    1. Open enumeration abc.En in the editor.
    2. Put caret over X constant in editor.
    3. Invoke the context menu and choose Refactor/Rename... .
    4. Change name to W and select Preview All Changes and Apply Rename in Comments checkboxes.
    5. Confirm dialog by Next button.
    • EXPECTED RESULT: It should find 5 occurences of the constant.
  1. Refactoring 1.5 - Rename Field
    1. Open class abc.A in the editor.
    2. put caret over field list in the editor.
    3. Invoke the context menu and choose Refactor/Rename... .
    4. Change name to testFieldName .
    • EXPECTED RESULT: Verify that the result is correct (the project is compilable and the field was renamed). 5 occurrences were updated
  1. Refactoring 1.5 - Rename Annotation Type
    1. Open annotation abc.def.DAnnotType in the editor and select DAnnotType in source text.
    2. Invoke the context menu and choose Refactor/Rename... .
    3. Change name to AnnotType and press Preview
    • EXPECTED RESULT: It should find 17 (13 if 'Apply Rename on Comments' is unchecked) occurences of the annotation type.
  1. Refactoring 1.5 - Rename Annotation Type Member
    1. Open annotation abc.def.DAnnotType in the editor and select coord member in source text.
    2. Invoke the context menu and choose Refactor/Rename... .
    3. Change name to dcoord and press Preview button
    • EXPECTED RESULT: It should find 2 occurences of the member of annotation type.
  1. Refactoring 1.5 - Move Class I
    1. Open class abc.A in the editor.
    2. Find node correspoding to class abc.A in the explorer (projects view).
    3. Invoke the context menu and choose Refactor/Move Class... .
    4. Set destination package to abc.def .
    • EXPECTED RESULT: Verify that the result is correct (the project is compilable and the class was moved). 14 occurrences were updated
  1. Refactoring 1.5 - Move Class II
    1. Open enumeration abc.En in the editor.
    2. Find node correspoding to enumeration abc.En in the explorer (projects view).
    3. Invoke the context menu and choose Refactor/Move Class... .
    4. Set destination package to abc.def .
    • EXPECTED RESULT: Verify that the result is correct (the project is compilable and the enumeration was moved). 8 occurrences were updated
  1. Refactoring 1.5 - Encapsulate Fields
    1. Open class abc.A in the editor.
    2. Put caret over field list .
    3. Invoke the context menu and choose Refactor/Encapsulate Fields... .
    4. Leave the default values in the dialog untouched (encapsulate only list , field visibility private , accessor visibility public , use accesors even if field is visible true .
    • EXPECTED RESULT: Verify that the result is correct (all occurrences of list in abc.A and abc.B should be replaced, the generated methods should have generics types).
  1. Refactoring 1.5 - Change Signature
    1. Open class abc.A in the editor.
    2. Put caret over field abc.A.methodA(T, String, boolean, String...) in the editor.
    3. Invoke the context menu and choose Refactor/Change Method Parameters... .
    4. Make some changes.
    • EXPECTED RESULT: Verify that the result is correct.


Generated: Tue May 22 17:11:15 CEST 2007

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo