STS 68 Java

Test Specification: Java Sanity Test Specification

Author: Jiri Prox
Version: 6.8
Introduction: This document serves as a sanity test specification for java module and related minor modules as javadoc, beans, hints. It cover most important parts of functionality.

Contents


Test suite: Syntax Coloring

Purpose: This suite test syntax highlighting.
Setup:Open the test project. Wait till the sources are parsed and indexed (it can took a quite long time, it the IDE was started from the fresh userdir).

  1. Class Members
    1. Open class coloring.Colors from sample project
    2. Check coloring of class members
    • EXPECTED RESULT: Image:members_STS_68_Java.png
  1. Static Members
    1. Open class coloring.Colors2 from sample project
    2. Check coloring of static members
    3. Delete static keyword
    • EXPECTED RESULT: Static members are printed in italics. The the keyword static is removed it is repainted with regular font
  1. Unused Imports
    1. Open class coloring.Imports from sample project
    2. Check colors
    • EXPECTED RESULT: Unused imports are gray underlined
  1. Javadoc Colors
    1. Open class coloring.JavaDoc from sample project
    2. Check colors
    • EXPECTED RESULT: Image:javadoc_STS_68_Java.png
   

Test suite: Normal Code Completion

Purpose: This test suite focus normal code completion (ctrl-space). When completing class name it provides only classes which are imported in current source file. It does not respect expected type of completed element. The code completion is context aware, it means it can provide elements of requested kind (e.g exceptions, packages, interfaces or regular classes, but does not know anything about the type!)
The items of normal code completion are listed in the lower part of code completion popup (under the line) if there are also provided items from smart code completion (see the next test suite).
The shortcut CC widely used in this document stands for Code Completion

  1. Basic Case
    1. Open class completion.Normal from sample project
    2. Inside method test try type following and invoke CC (if not popup automatically):
      1. this.
      2. list.
      3. list.
      4. Thread.
      5. threads[0].
      6. String.
    3. Try several cases by your own.
    • EXPECTED RESULT: Each time the list of proposed completions is provided. It has the right context and provides only items which are suitable in current position. Check return types of generic types (2nd point in list). Watch also the static and non-static context.
  1. Context Aware
    1. Open class completion.NormalContextAware from sample project
    2. add import to the proper place and open CC
    3. add extends to the proper place and open CC
    4. add implements to the proper place and open CC
    5. add throws to the constructor and call CC
    6. add
              try {
      
FileReader fr = new FileReader(new File("")); } catch ( fix imports and call CC behind the last opening brackets
    1. type throw new int method body call CC
    2. Repeat steps 2-7 but before invoking completion type several letters
    • EXPECTED RESULT:

The completion result contain only classes of expected kind, if any prefix was typed all items must match this prefix. Note the CC after implements keyword can contain also regular classes if there is inner interface inside them (example: class Thread contains UncaughExceptionHandler ). At the end of the list there are provided available packages as well.

  1. Anonymous Class
    1. Create new class
    2. In constructor write following code:
       
      
new Runnable() { public void run() { } public void method() { } public int field; }.
    1. Invoke CC after the dot
    • EXPECTED RESULT: Code completion contains method run() , method() and filed field , others item are from class Object
  1. Method Finishing
    1. Open class completion.NormalMethods from sample project
    2. Inside testMethod type method
    3. Call CC and select one of the provided items
    • EXPECTED RESULT: The CC provides 4 possible completion, after confirming one of them the text is substituted, the parameter names are copied to code (no parameters matching takes part in this situation) and the parameter tooltip is opened.
  1. Creating Anonymous Class Body
    1. Create new class
    2. It it's constructor type new Comparable
    3. Call code completion and select first item
    • EXPECTED RESULT: The whole class body is added. Check if compareTo method has one parameter of type Object.
  1. Switch Controled By Enum
    1. Open class completion.NormalSwitch from sample project
    2. in the switch statement type case
    3. call code completion
    • EXPECTED RESULT: CC provides only constants from enum Type


Test suite: Smart Code Completion

Purpose: Smart code completion return only items with has (or return) the type suitable in current position. It's invoked by shortcut Ctrl-Space and takes the upper part of code completion popup. Setup:

  1. Assign Statement
    1. Open class completion.SmartAssign from sample project
    2. Type List l = at the end of test method and call smart CC
    3. Replace last entered line with List<String> l = and call smart CC
    4. Replace last entered line with List<String> l = new and call smart CC
    • EXPECTED RESULT: In step 2 the all methods returning List and all fields, parameters and local variables of type List (and assignable types) are returned.
      In step 3 only elements of type List<String> are returned.
      In step 4 all available classes expanding List<String> are provided, if something is selected import is added if necessary
      Note: The type of variable which is being assigned to must be resolved, it means the java.util.List must be imported in this case.
  1. Return Statement
    1. open class completion.SmartReturn from sample project
    2. Replace last line of method getName with return and call smart CC
    3. Replace last line of method getName with return "". and call smart CC
    4. Replace last line of method getName with return new and call smart CC
    • EXPECTED RESULT: In step 2 all elements of type (or returning type) String are listed together with all static methods from class java.lang.String returning String
      In step 3 all methods of java.lang.String returning String are listed
      In step 4 identifier String is inserted, since it was the only possible completion in this situation (String cannot have subclasses it's final)


Test suite: All Symbols Code Completion

Purpose: All Symbols Code Completion returns all classes with required prefix which are available (in JDK, in current project or additional libraries), even when they are not imported. After selecting item from list an import statement is added if necessary.

            

Setup:

  1. All Classes
    1. Open any class
    2. Add several places call All Symbols CC
    • EXPECTED RESULT: Check if CC provides all available classes matching entered prefix


Test suite: Keyword Code Completion

Purpose: The normal code completion provides also keywords which can be used in current position
Setup:

  1. Within Class
    1. Create new class
    2. Delete all its content except package statement
    3. Try to enter whole class with several method, field and inner classes using CC to produce all keywords (only typing identifiers and symbols like brackets and operators by hand)
    • EXPECTED RESULT: The whole class can be written using only CC to insert keywords


Test suite: Code Completion Settings

Purpose: This suite focus on customizing code completion behavior. All options mentioned in following test cases can be found in Tools | Options | Editor | General | Code Completion
Setup:

  1. Auto Popup
    1. Uncheck Auto Popup Completion Window
    2. In any class type this.
    3. Restore the default value and repeat previous step
    • {{result|EXPECTED RESULT: The completion window is not opened when pressing '.' if the option is turned off
  1. Automatic Substitution
    1. Uncheck Insert Single Proposals Automatically
    2. In editor type StringBuffe and call normal code completion
    3. In editor type Thread.curren and call normal code completion
    4. Restore the default value and repeat previous two steps
    • EXPECTED RESULT: The CC list provide one item but does not insert it if the options if switched off. Automatic substitution for class names is always turned off.
  1. Case Sensitive
    1. Check Case Sensitive Code Completion
    2. In editor type string and call normal code completion
    3. type String and call CC
    4. Revert changes in options and repeat step 2
    • EXPECTED RESULT: In step 2 the CC should return no suggestions since there is no such class. The step 3 and step 2 after returning changes should provide String* items

  1. Closing Brackets
    1. Uncheck Insert Closing Brackets Automatically
    2. In constructor type
       this( 
    3. In class body type
       int[ 
    4. In class body type
       void method( 
    5. Revert changes and repeat steps 2-4
    • EXPECTED RESULT: Closing bracket in not inserted if option is turned off. The closing bracket of correct type is inserted otherwise, the cursor is located between them.


Test suite: Parameter ToolTip

Purpose: Parameter tooltip shows expected parameter (types and names) of method call. It highlights actual parameter when moving cursor within method call.
Setup:

  1. Method Call
    1. Open class tooltip.ParamToolTip from sample project
    2. In method test type method(|) , the '|' stands for cursor position
    3. Press Ctrl-P
    4. Type 1,1.2
    5. Complete method call by providing all required arguments
    • EXPECTED RESULT: In step 3 the parameter tooltip is shown displaying 3 possible combination of parameters. The list if filtered as typing parameters (when ',' is entered) to contain only valid rows.
  1. Moving Among Parameters
    1. Open class tooltip.ParamToolTip from sample project
    2. In method test type method(|1,2.2,"sss", "sss", this);) , the '|' stands for cursor position
    3. Invoke parameter tooltip and browse parameters by arrow-keys
    • EXPECTED RESULT: The tooltip highlights correctly parameter under cursor.


Test suite: Javadoc

Purpose:
Setup:

  1. Combined With Proper Completion
    1. Repeat several test cases form suites focused on code completion
    • EXPECTED RESULT: Javadoc window is opened each time CC window displays. It contains right part javadoc.
  1. Javadoc Navigation
    1. Open javadoc window
    2. Try buttons in window header
    3. Try window scrolling
    4. Try to click on hyperlink
    • EXPECTED RESULT: Scrolling using scrollbars or keyboard (shift+arrow key or shift+pgup/pgdown) works. Clicking on hyperlink changes the document. The buttons in window header has this functionality:
    • Navigate to previous page
    • Navigate to next page
    • Open in browser
    • Go To Source
   

Test suite: Matching Method Call Parameters

Purpose:
Setup:

  1. Matching Name
    1. Open matching.Matching from the sample project
    2. At the last line of test method type method
    3. Finish the method call from CC
    • EXPECTED RESULT: The code is finished with following code: method(name, lastName, aux); . There are variables or fields with the same name and type for the first two parameters, so they are used. For the last parameter there are not any int named number and nearest other int is used (aux in this case)


Test suite: Go To Navigation

Purpose:
Setup:

  1. Go To Source
    1. Open navigation.GoToSource from the sample project
    2. Put caret on line 30 word String and from contex menu call Navigate | Go To Source
    3. Put caret on line 30 word string and from context menu call Navigate | Go To Source
    4. Put caret on line 31 word string and from main menu call Navigate | Go To Source
    5. Put caret on line 32 word string and from main menu call Navigate | Go To Source
    6. Put caret on line 32 word charAt and press Ctrl_Shift-B
    • EXPECTED RESULT: In steps 2-5 class java.lang.Sting is opened and cursor is placed at the class header. In step 6 the cursor is placed to the method char chatAt(int)
  1. Go To Declaration
    1. Open navigation.GoToSource from the sample project
    2. Put caret on line 30 word String and from context menu call Navigate | Go To Declaration
    3. Put caret on line 31 word string and press Ctrl-B
    • EXPECTED RESULT: In the firs case the class String is opened and cursor is moved to the class declaration. In the second case the cursor is moved to the line 30, where variable string is declared. Try it also with fields, parameters and inner classes.
  1. Go To Type - Wildcard
    1. Open Go To Type dialog
    2. Enter criterion containing wildcards (*, ?)
    • EXPECTED RESULT: Check that all found classes match the criterion
  1. Go To Type - Capital Letters
    1. Open Go To Type dialog
    2. Enter only capital letters from name of some class (e.g. ATM for AbstractTableModel)
    • EXPECTED RESULT: Desired classes are found
  1. Go To File - basic case
    1. Open Go To File dialog (alt-shift-O)
    2. enter some name of file
    3. use wildcards in the name
    • EXPECTED RESULT: Files matching the pattern are found, project from main project are at the beginning of the list and have different color. After confirmation, the selected file is opened


Test suite: Navigator Window

Purpose: Navigator window, located below the project view, displays inner structure of the selected class. It can be filtered and sored. Double click on tree list will bring cursor to the source (Go To Source function)
Setup:

  1. Class Structure
    1. Open navigator.ClassStructure from sample project
    2. Check content of navigator
    • EXPECTED RESULT: Image:navigator-class_STS_68_Java.png
  1. Filters
    1. Open navigator.ClassStructure from sample project
    2. Change navigator filters - use buttons and context menu
    3. Each time check context of navigator
    • EXPECTED RESULT:
    • Show Inherited Members : Shows also members from all superclasses
    • Show Fields: hides/shows fields
    • Show Static Members: hides/shows static members (methods, fields, inner classes ....)
    • Show Non Public Members: if turned off, only public members are displayed
    • Sort By Name : members are sorted by their name
    • Sort By Source : members are sorted by their position in source file (the last two filters are mutaly exclusive)
  1. Navigation To Source
    1. Open navigator.ClassStructure from sample project
    2. Double click on any item
    • EXPECTED RESULT: Cursor is located at the declaration of selected member
  1. Class file
    1. Add jar to the project classpath (right click on libraries node, Add Jar/Folder and select any jar)
    2. Unfold contents of the added jar and select any .class file
    • EXPECTED RESULT: Navigator shows members of the class file


Test suite: Mark Occurrences

Purpose:
Setup:

  1. Show Usages
    1. Open occurrences.MarkOccurrences from the sample project
    2. Put cursor on name of variable/field/method/parameter (eg. variable on line 40, field on line 31, method on line 33, param on line 33)
    • EXPECTED RESULT: All occurrences of selected element is highlighted in editor and error stripe.
  1. Return Points
    1. Open occurrences.MarkOccurrences from the sample project
    2. Put caret on return type of method at line 33
    3. Put caret on exception in throws clause statement at line 33
    • EXPECTED RESULT: In step 2 all exit point from method are highlighted (4 occurrences). In next step only places where the selected exception is thrown are highlighted (2 occurrences).
  1. Show Usages - Class
    1. Open occurrences.MarkOccurrences from the sample project
    2. Put caret on String at line 31
    • EXPECTED RESULT: All usages of java.lang.String in current class are highlighted
  1. Options - On/Off
    1. Open options and disable Mark Occurrences Of Symbol Under Caret
    2. Go back to editor, put caret on any identifier (method name, class name, field)
    3. Enable MarkOccurrences again
    • EXPECTED RESULT: While MO (Mark Occurrences) is disabled, no occurrences are highlighted.
  1. Mark Occurrences - Types, Methods
    1. Open options and disable Types and Methods
    2. Put caret on line 33 word method or line 31 word String
    3. Enable options again
    • EXPECTED RESULT: Occurrences on lines 31,33, 40 (for class) and 31,44 (for method) are not highlighted when options are disabled
  1. Mark Occurrences - Exceptions, Exit Points
    1. Open options and disable Exceptions Throwing Points
    2. Put caret on line 33 word String
    3. Put caret on line 33 word IOException
    4. Enable the option again and disable Exit Point From Method
    5. Put caret on line 33 word String
    6. Put caret on line 33 word IOException
    7. Enable the option
    • EXPECTED RESULT: In step 2) the editor highlights both exit point from method (return and throw - 4 occurrences). In step 3) occurrences of class IOException are marked (3 occurrences, watch the Keep Marks option). In step 5) all occurrences of String are highlighted (3) and in step 6) 2 places where can be thrown selected exception are marked
  1. Mark Occurrences - Keep marks
    1. Open options and disable Keep Marks
    2. Select several elements, which can be highlighted
    3. Enable the option again and repeat step 2
    • EXPECTED RESULT: When option is disabled the actual mark occurrences marks are discarded when the location of caret is changed, regardless if another highlights are created or not. When enabled, the old marks are removed only in new set of marks is created.
  1. Browsing
    1. Select element which has more occurrences (e.g class String)
    2. Press Alt-Up, Alt-Down
    • EXPECTED RESULT: The caret jumps among the marks


Test suite: Fix Imports

Purpose:
Setup:

  1. Simple Fix Import
    1. Open fiximports.FixImports from the sample project
    2. Delete all import statements
    3. Call Fix Imports (context menu or Ctrl-Shift-I)
    4. Select right classes in comboboxes and confirm
    • EXPECTED RESULT: All imports are properly added
  1. Fast Import
    1. Open fiximports.FixImports from the sample project
    2. Delete all import statements
    3. Put caret on unresolved symbol and press Alt-Shift-I
    4. Select required class from list and confirm by Enter
    • EXPECTED RESULT: Selected class is imported
  1. Fast Import - package
    1. Open fiximports.FixImports from the sample project
    2. Delete all import statements
    3. Put caret on unresolved symbol and press Alt-Shift-I
    4. Select required class from list and confirm by Alt-Enter
    • EXPECTED RESULT: Whole package is imported
  1. Fast Import - FQN
    1. Open fiximports.FixImports from the sample project
    2. Delete all import statements
    3. Put caret on unresolved symbol and press Alt-Shift-I
    4. Select required class from list and confirm by Shift-Enter
    • EXPECTED RESULT: The identifier is replaced with FQN


Test suite: J2SE Project

Purpose: This suite describes basic project customization. It is focused mainly on changing project classpath and switching source level and java platform
Setup:

  1. Creating
    1. Go to File | New Project
    2. Select General -> JavaApplication and click Next
    3. Specify the project name and location, keep both checkboxes checked and confirm by Finish
    4. Check basic functionality - code completion, fiximports, folding, syntax coloring
    • EXPECTED RESULT: Project is created in given location. It contains class Main and is set as default. All functionality is working fine
  1. Adding Libraries
    1. Open project properties (context menu or menu file)
    2. Select Libraries and Compile tab
    3. Click Add Library and add any library
    • EXPECTED RESULT: After adding the library jars are indexed. Check function as Fix Import, Code Completion, Go To Type (if sources are present) and Smart CC are working for library classes.
  1. Adding Jars
    1. Follow steps in previous test case, but add a simple jar instead of whole library.
    • EXPECTED RESULT: Check function as Fix Import, Code Completion, Go To Type (if sources are present) and Smart CC are working for classes contained in jar.
  1. Dependency on Others Project
    1. Follow steps in previous test case, but add another NB project to the dependencies
    • EXPECTED RESULT: Check if all functionality is working. The Go To source and Javadoc should work for the classes from different project. Test checkbox Compile Project on Classpath

  1. Building
    1. Build project
    • EXPECTED RESULT: Check if all library jars are copied to dist/libs folder. They can be added as library, NB project or single jar. The folder with classes is not copied to the lib (performance purposes)

  1. Switching Platform and Source Level
    1. In project properties, Sources tab select different source level and compile.
    2. In project properties, Libraries tab select different java platform and compile project
    • EXPECTED RESULT: In the first step the build will provide jar for desired java version. Test usages of 1.5 features when source level is set to 1.4. Try running jar, compiled for 1.5 to run with JDK1.4
      In the second step the new java platform is indexed (if not used yet) and the features like CC, fiximports etc... works ok. Check range of source levels for new platform.


Test suite: Members View

Purpose:
Setup:

  1. Members of actual class
    1. Put focus in editor and press ctrl-F12
    2. Inspect opened dialog
    • EXPECTED RESULT: The dialog Members is opened. In the left part there is tree reflecting class members. In the righr there is javadoc for selected element. File:Members-view.png
  1. Filters - Button
    1. Open Members View for class SuperClass
    2. Try functionality for each filter button in the bottom part of dialog
    3. Check persistence of filter buttons state between dialog invocation
    • EXPECTED RESULT: Each button controls displaying specific types of elements. For more info check the button tooltip. State of each button is preserved between dialog invocation.

  1. Text Filter
    1. Invoke Members View dialog
    2. Type several character in the filter textfield (upper part of dialog)
    3. Repeat steps 2) while Case Sensitive checkbox is checked
    • EXPECTED RESULT: The elements in tree are filtered to containg only matching items and the nodes corresponding to classes and interfaces


Test suite: Hierarchy View

Purpose:
Setup:

  1. Actual class hierarchy
    1. Put focus in editor and press alt-F12
    2. Inspect opened dialog
    • EXPECTED RESULT: The dialog Hierarchy is opened. In the left part there is tree reflecting the class hierarchy. In the right there is javadoc for selected element. File:Hierarchy-view.png
  1. Hierarchy - filter buttons
    1. Open hierarchy view for for class SuperClass
    2. Try toggedle each filter button in the lower part of the dialog
    • EXPECTED RESULT: The buttons have following functions (from left to right):
    • Show super type hierarchy - the hierarchy tree contains only superclasses and implemented interfaces. For each of them its superclass/implemented interfaces are listed as well
    • Show subtype hierarchy - all subclasses are listed, plus the superclasses of curren class.
    • Show fully qualified names - the items in tree are identified by FQNs
    • Show inner classes and interfaces - the hierarchy tree shows ale the inner classes and intefaces
    • Expand All - expands whole tree
  1. Hierarchy - navigation
    1. Open Hierarchy View for any class
    2. Double click on item from hierarchy tree
    3. Repeat step 2) from different items
    • EXPECTED RESULT: The related source file is opened and cartet is located over declaration of selected element


Test suite: FreeForm project

Purpose:
Setup:

  1. Creating freeform project
    1. Unzip attached archive
    2. File -> New Project, select Java Free form project
    3. On next page enter the path to the extracted archive in the Location textfield, the others textfields should be filled automatically
    4. On next page the 3 ant targets should be prefilled in appropriate textfields (compile, clean, test), keep the defaults
    5. On next page add 'source' subfolder to Source Package Folders and 'test' subfolder as Test Package Folder, continue on next page
    6. Add CoreLib.jar from libs subfolder to source classpath, and JUnit from the same folder to the classpath for tests
    7. Press Finish
    • EXPECTED RESULT: Project is created, there are no compilations error, project can be build


Test suite: Node tooltips

Purpose:
Setup:

  1. Contains main method
    1. Create class with main method
    • EXPECTED RESULT: Node in project wiev has green arrow badge, the tooltip says 'Contain main class'
  1. Need recompilation
    1. Make sure Compile on save is disabled
    2. Edit some file and save it
    3. Compile edited file
    • EXPECTED RESULT: When file is edited the out-of-data icon (wrench) is displayed and tooltip contains 'Needs to be compiled'. After compilation the badge and tooltip go away
  1. Error badge
    1. Make an error in the class and save it
    2. Correct the error
    • EXPECTED RESULT: The class containing the error is marked with the error badge, the badge is propagated to package, source root and project. The tooltis says 'Error parsing file' for file, and 'Contains files with error' for the other nodes. Once the error is corrected the badges disappears


Test suite: UI

Purpose: This suite is focused on menu item availability.
Setup: Create new J2SE project, make sure that Compile On Save is enabled (Compile tab of project properties). Run the project

  1. Compile project
    1. Open context menu on project
    2. Open Run main menu
    3. Press Build
    • EXPECTED RESULT: The dialog warning about the fact that clean&build must be performed instead of build is shown.
  2. Compile project with errors
    1. Make a syntax error in the code
    2. Run the project
    • EXPECTED RESULT: The dialog informing about uncompilable code is shown. The user have possibility to cancel run or to continue. There is checkbox to disable this dialog next time
  3. Disable/Enable CoS
    1. Open project properties
    2. Switch to Compile tab
    3. Disable CoS
    4. Close properties
    5. Enable CoS again
    • EXPECTED RESULT: Clean is performed when setting is changed


Test suite: Compiling, Building,Running

Purpose: This suite describes compiling a building project
Setup: Locate the directory, where are stored compiled classes. The location should be {userdir}/var/cache/index/{index_version}/sX/classes, where X is a decimal number
Comments: The test cases should be performed in a row since they depends on result of previous case.

  1. Change and save
    1. Open class from the project
    2. Clean it
    3. Make sure CoS is enabled
    4. Make some modification and save
    • EXPECTED RESULT: The related .class file is updated, but only in userdir, Need to Compile batch should appear. Compile actions are enabled
  2. Compile
    1. Compile the modified file (F9)
    • EXPECTED RESULT: The file is compiled by ant. Need to compile badge disappears. Compile action is still enabled
  3. Build
    1. Build project
    • EXPECTED RESULT: Build is performed by ant
  4. Run
    1. Run project
    • EXPECTED RESULT: The classes from userdir are copied to build/classes folder, the application is launched with build/classes folder on it's classpath. Compile actions are disabled, need to compile badges are not visible
  5. Modify source
    1. Modify any file
    2. Save it
    • EXPECTED RESULT: The .class files is updated in build/classes folder, need to compile badge is not shown
  6. Run project
    1. Run project
    • EXPECTED RESULT: The project is launched w/o any compilation of copying classes
  7. Build project
    1. Build project
    • EXPECTED RESULT: The dialog asking of performing Clean&Build is shown. Cancel the action
  8. Clean
    1. Cleans project
    • EXPECTED RESULT: The content of build/classes is erased. The compile action is enabled again, Need to compile badges appears for all source files


Test suite: Dependend projects

Setup: Have a projct A and B,A is depending on B

  1. Running A
    1. Enable CoS for project A
    2. Run project A
    • EXPECTED RESULT: The CoS is applied on both projects -> classes are copied from userdir if necessary, application has build/classes dirs on its classpath. The behavior is not dependent on project B
  1. Building A
    1. Make sure CoS is enabled for A
    2. Clean&Build project A
    • EXPECTED RESULT: The A is cleaned and build, if there was classes fro inner javac in buidl/classes of project B, the project is cleaned as well. Otherwise B is only build by ant.
  1. Running B
    1. Run project B
    • EXPECTED RESULT: Running depends on CoS setting of project B. No setting of A is taking in account


Test suite: Errors in code

  1. Building A
    1. Make sure CoS is enabled for A
    2. Clean&Build project A
    • EXPECTED RESULT: The A is cleaned and build, if there was classes fro inner javac in buidl/classes of project B, the project is cleaned as well. Otherwise B is only build by ant.
  1. Running B
    1. Run project B
    2. Press Run Anyway
    • EXPECTED RESULT: The dialog announcing error in code is opened when running. The Runtime exception is thrown when application gets to the syntax error.
  1. Disable dialog
    1. Run project B
    2. Check 'Always run w/o asking'
    3. Press Run Anyway
    • EXPECTED RESULT: The dialog is never opened when running project with errors


Test suite: Basic hints

Purpose: Testing of baisc java Hints.
Setup: Open prepared test project.

  1. Simple Import
    1. Place caret at basic.Import:13
    2. Use hint Add import for javax.swing.JTable
    • EXPECTED RESULT: Import is properly added
  1. Simple Import 2
    1. Place caret at basic.Import:14
    2. Press "Alt-Enter"
    • EXPECTED RESULT: The hint Add import for FileReader is shown only once
  1. Import - Multiple Choice
    1. Place caret as basic.Import:15
    2. Press Alt-enter
    • EXPECTED RESULT: Two possible imports are available to be added
  1. Exceptions
    1. Make sure Surround with try-catch hint is enabled in Options -> Java Code -> Hints
    2. Place caret at basic.Exceptions:20
    3. Use Add throws clause hint
    4. Undo change and use both variant of Surround Statement/Block with
    • EXPECTED RESULT: In 3) the throws clause is added and hint in no longer provided on current line. In 4) the one line (Surround statemenr) of whole method body is surrounded with try-catch
  1. Exceptions - adding catch clause
    1. Place caret at basic.Exceptions:20
    2. Use Surround Block with hint
    3. Place caret on next line
    4. Use Surround Block with hint
    • EXPECTED RESULT: The catch clauses is added to the existing one after step 4
  1. Exceptions - more exceptions
    1. Place caret at basic.Exceptions:28
    2. Try separately all hints: Surround Block/Statement with hint and Add throws
    • EXPECTED RESULT: Two catch clauses are created/ throws exception is added to throws list
  1. Cast
    1. Place caret at basic.Cast:27
    2. Use hint Cast o
    • EXPECTED RESULT: Cast to Number is added
  1. Cast - return
    1. Place caret at basic.Cast:19
    2. Use hint Cast get(...)
    • EXPECTED RESULT: Cast to String is added
  1. Cast - return 2
    1. Place caret at basic.Cast:22
    2. Use hint Cast get(...)
    • EXPECTED RESULT: Cast to List<? extends Integer> is added
  1. Cast - method argument
    1. Place caret at basic.Cast:32
    2. Use hint Cast o
    • EXPECTED RESULT: Cast to List is added
  1. Change type - field
    1. Place caret at basic.ChangeType:17
    2. Use hint Change type
    • EXPECTED RESULT: Type of field is changed to Integer
  1. Change type - return
    1. Place caret at basic.ChangeType:23
    2. Use hint Change type
    • EXPECTED RESULT: Type of field is changed to proper type
  1. Implement All abstract method
    1. Place caret at basic.ImplementAll:16
    2. Use hint Implement all abstract methods...
    • EXPECTED RESULT: public void run() is added, it contains only throw new UnsupportedOperationException("Not supported yet.");
  1. Implement All abstract method - generics
    1. Place caret at basic.ImplementAll:20
    2. Use hint Implement all abstract methods...
    • EXPECTED RESULT: All required methods are added, the generic type is used correctly
  1. Implement All abstract method - abs. class
    1. Place caret at basic.ImplementAll:24
    2. Use hint Implement all abstract methods...
    • EXPECTED RESULT: Methods from Runnable and AbsClass are added, @Override annotation is added to absMethod()
  1. Missing element
    1. Make sure Create local variable hint is enabled
    2. Place caret at basic.MissingElement:15
    3. Use hint to create local variable
    4. Use hint to create method parameter
    5. Use hint to create field
    6. Change type on the right side to smtg else (new List<String>(); 1.3f; method call; etc...)
    • EXPECTED RESULT: The local variable/parameter/field with correct type is created
  1. Missing element - static
    1. Place caret at basic.MissingElement:19
    2. Use hint to create field in AuxClass
    • EXPECTED RESULT: The static filed is created in AuxClass
  1. Create method
    1. Place caret at basic.CreateMethod:16
    2. Use hint to create new method
    • EXPECTED RESULT: The new private method is created in current class, all argument and return type are correct
  1. Create method
    1. Place caret at basic.CreateMethod:17
    2. Use hint to create new method
    • EXPECTED RESULT: The new static method is created in AuxClass
  1. Initialize primitive type
    1. Place caret at basic.Initialize:21
    2. Use hint to initialize variable
    3. Change int to different primitive type (or array)
    • EXPECTED RESULT: The variable is initialized by correct value
  1. Initialize object
    1. Place caret at basic.Initialize:23
    2. Use hint to initialize variable
    3. Change String to different primitive type (array of types, generic type etc...)
    • EXPECTED RESULT: The variable is initialized by correct value


Test suite: Standard Javac Hints

Purpose: Testing of Standard Javac Hints functionality.
Setup: Enable all hints in category Standard Javac Warnings, disable all other hints. Open Standard.java class

  1. Serialization
    1. Place caret on line 16, invoke hint.
    • EXPECTED RESULT: Warning about undefined serialVersionUID.
  2. Finally
    1. Place caret on line 31, invoke hint.
    • EXPECTED RESULT: Warning displayed, stating finally clause cannot complete normally.
  3. Fallthrough
    1. Place caret on line 28, invoke hint.
    • EXPECTED RESULT: @SuppressWarnings("fallthrough") added, before method declaration.
  4. Deprecated
    1. Place caret on line 20, invoke hint.
    • EXPECTED RESULT: @SuppressWarnings("deprecation") added, before method declaration.
  5. Empty statement after if
    1. Place caret on line 22, invoke hint.
    • EXPECTED RESULT: Warning displayed, stating empty statement after if.
  6. Unnecessary cast
    1. Place caret on line 21, invoke hint.
    • EXPECTED RESULT: Redundant cast has been removed.
  7. Division by zero
    1. Place caret on line 23, invoke hint.
    • EXPECTED RESULT: Warning displayed, stating division by zero.
  8. Unchecked
    1. Place caret on line 19. Invoke hint.
    • EXPECTED RESULT: @SuppressWarnings("unchecked") annotation should be added before method declaration.
    1. Place caret on line 42. Invoke hint.
    • EXPECTED RESULT: Warning displayed, stating foo(java.lang.String[[ | ]]) in standard.Standard.java ....


Test suite: General Hints

Purpose: Testing of General Hints feature functionality.
Setup: Enable all hints in category General, disable all other hints. Open "General.java".

  1. Local variable Hides a Field
    1. Place caret on line 16.
    2. Invoke appeared hint.
    • EXPECTED RESULT: This should invoke Instant rename action on local variable field. Field field shouldn't be affected.
  2. Double checked locking
    1. Place caret on line 53
    2. Invoke appeared hint
    • EXPECTED RESULT: The outer if statement has been removed.
  3. Assign Return Value to New variable
    1. Place caret on LOC 18, inside parseInt(String) call.
    2. Invoke appeared hint
    • EXPECTED RESULT: Return Value of parseInt() assigned to newly created variable, which becomes selected.
  4. String Comparing
    1. Put caret on line 19
    • EXPECTED RESULT: Comparing warnings shown inside gutter.
  5. Generate Missing hashCode()
    1. Invoke hint on LOC 34.
    2. Inside appeared dialog, check int x.
    • EXPECTED RESULT: hashCode() generated, returning value based on x and a random prime number.
  6. Generate Missing equals()
    1. Invoke hint on LOC 44.
    2. Inside appeared dialog, check int x.
    • EXPECTED RESULT: equals() method is generated, using value of x.
  7. Accessing static via reference
    1. Place Caret on line 22 and invoke appeared hint.
    2. Place Caret on line 24 and invoke appeared hint.
    • EXPECTED RESULT: this(), resp. g replaced with General.
  8. Incorrect Package
    1. Invoke hint on LOC 5
    • EXPECTED RESULT: Package declaration has been altered as appropriate.
  9. Assignment to itself
    1. Put caret on line 81
    • EXPECTED RESULT: Warning should be shown LOC 81
  10. Hided field inherited from superclass
    1. Invoke hint on LOC 67
    • EXPECTED RESULT: This should bring up Rename Refactoring invoked on Integer ff.
  11. Synchronization on non-final field
    1. Open General2.java
    2. On line 16 there is warning
    3. add keyword final to the declaration on line 13
    • EXPECTED RESULT: There is warning when the file is opened. When keyword is added the warning disappears.
  12. .equals Method not Checking Type
    1. Open General2.java
    2. On line 22 there is warning
    3. Add if(obj instanceof Object) { }; or if(obj instanceof Object) { }; to line 23
    • EXPECTED RESULT: There is warning when the file is opened. When code is added the warning disappears.
  13. .equals on Incompatible Types
    1. Open General2.java
    • EXPECTED RESULT: On lines 41 - 44 there are warnings.
  14. .equals on Incompatible Types
    1. Open General2.java
    2. Put caret on line 50
    • {{{1}}}


Test suite: JDK 5 Hints

Purpose: Testing of JDK 5 and later specific hints.
Setup: Open "JDK15.java". Enable all hints in category "JDK 1.5 and later", disable all other hints.

  1. Add @Override
    1. Place caret on line 24
    2. Invoke hint (may be hidden "under" override glyph in gutter).
    • EXPECTED RESULT: @Override annotation should be added before method declaration. Code should be properly formatted.
  2. Annotation as superinterface
    1. Place caret on LOC 16.
    • EXPECTED RESULT: Warning displayed, stating 'Don't use annotation Deprecated as superinteface'.


Test suite: Import hints

Purpose: Testing of import hints.
Setup: Open "imports.ImportsImport.java". Enable all hints in category Imports, disable all other hints.

  1. Forbidden package
    1. Place caret on line 13, invoke hint.
    • EXPECTED RESULT: Warning displayed, stating 'Import from forbidden package'.
  2. Forbidden package 2
    1. Invoke Tools|Options|Java Code|Hints|Imports|Import From Forbidden Package.
    2. Add a package patten, ie importpack.**. and Confirm OD.
    3. Add import matching the given pattern.
    • EXPECTED RESULT: Warning should be displayed also for imports of the added package from now on.
  3. Star import
    1. invoke hint on LOC 12.
    • EXPECTED RESULT: Warning should be displayed, stating 'Star Import'.
  4. Unused import
    1. Invoke hint on LOC 9.
    • EXPECTED RESULT: Unused import should be removed. If there are more unused imports, the hint Remove All Unused Imports should be provided as well
  5. Import from java.lang.**
    1. Invoke hint on LOC 11.
    • EXPECTED RESULT: Import should be removed.
  6. Import from same package
    1. Invoke hint on LOC 14.
    • EXPECTED RESULT: Import should be removed.


Test suite: Error fixes customization - since 6.1

Purpose: Test of customization of basic error fixing hints
Setup: Open any file.

  1. Create local variable inline
    1. Open Options -> Java Code->Hints and select Error fixes, Create local variable
    2. Uncheck Create local variable in line
    3. create new empty method and enter
      int a =3;
      int b = 3;
      z = a+b;
    4. use hint to create new local variable
    • EXPECTED RESULT: The decalration int z is created before other two declarations (NOTE: if there is super call, z is declared behind it)
  1. Try-catch customization
    1. Open file from some nb module
    2. Open OD and select Java Code -> Hitns -> Error Fixes -> Surround with
    3. Uncheck all enabled checkboxes
    4. Type FileReader fr = new FileReader(""); in editor
    5. use hint to surround it with try/catch
    6. try other templates for try/catch
    • EXPECTED RESULT: The code is surrounded by try/catch, the content of catch body corresponds with selected option
  1. Surround statement/block
    1. type in editor:
      System.out.println("firstline");
      new FileReader("aaa");
      System.out.println("lastline");
    2. use Surround statement with ....
    3. undo all changes
    4. use Surround block with ....
    • EXPECTED RESULT: In first case only one statement is surrounded, in the second case, the whole block is surrounded


Test suite: Beans property

Purpose: ""
Setup: "Open empty java class in editor"

  1. Adding property
    1. Put caret inside class body
    2. Press Alt-insert and select "Add property"
    3. Change Name, default value (at the same line as Name, behind '=') and Type text field to "prop","1","int"
    4. Keep other options as default and press OK
    • EXPECTED RESULT: New field and its getter and setter are generated.
  2. Getter/Setter
    1. Open Add property dialog
    2. Try generate only setter or getter
    • EXPECTED RESULT: Getter or setter is generated according to specified values
  3. Indexed
    1. Open Add property dialog
    2. Check "indexed" checkbox
    3. Enter property name, type and default value
    • EXPECTED RESULT:
   private String[] indexed_prop = {"a", "b", "c"};
   /**
    * Get the value of indexed_prop
    *
    * @return the value of indexed_prop
    */
   public String[] getIndexed_prop() {
       return this.indexed_prop;
   }
   /**
    * Set the value of indexed_prop
    *
    * @param newindexed_prop new value of indexed_prop
    */
   public void setIndexed_prop(String[] newindexed_prop) {
       this.indexed_prop = newindexed_prop;
   }
   /**
    * Get the value of indexed_prop at specified index
    *
    * @param index
    * @return the value of indexed_prop at specified index
    */
   public String getIndexed_prop(int index) {
       return this.indexed_prop[Index];
   }
   /**
    * Set the value of indexed_prop at specified index.
    *
    * @param index
    * @param newindexed_prop new value of indexed_prop at specified index
    */
   public void setIndexed_prop(int index, String newindexed_prop) {
       this.indexed_prop[Index] = newindexed_prop;
   }
  1. Javadoc
    1. Try any from the previous usecase
    2. Check the javadoc is correct in preview and in generated code
    3. Unselect javadoc checkbox
    4. Confirm dialog
    • EXPECTED RESULT: All method has javadoc stub. After unselecting the checkbox no javadoc is present in preview and generated code


Test suite: Firing events support

  1. Property change support
    1. Open Add property dialog
    2. Enter any property name and type
    3. Check "Generate Property Change Support"
    • EXPECTED RESULT: The firing event support is added in preview and into generated code. For property change this code is added:
   private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
   /**
    * Add PropertyChangeListener.
    *
    * @param listener
    */
   public void addPropertyChangeListener(PropertyChangeListener listener) {
       propertyChangeSupport.addPropertyChangeListener(listener);
   }
   /**
    * Remove PropertyChangeListener.
    *
    * @param listener
    */
   public void removePropertyChangeListener(PropertyChangeListener listener) {
       propertyChangeSupport.removePropertyChangeListener(listener);
   }        
  1. Property vetoable change support
    1. Open Add property dialog
    2. Enter any property name and type
    3. Check "Generate Vetoable Change Support"
    • EXPECTED RESULT: This code is added for vetoable change
   private VetoableChangeSupport vetoableChangeSupport = new VetoableChangeSupport(this);
   /**
    * Add VetoableChangeListener.
    *
    * @param listener
    */
   public void addVetoableChangeListener(VetoableChangeListener listener) {
       vetoableChangeSupport.addVetoableChangeListener(listener);
   }
   /**
    * Remove VetoableChangeListener.
    *
    * @param listener
    */
   public void removeVetoableChangeListener(VetoableChangeListener listener) {
       vetoableChangeSupport.removeVetoableChangeListener(listener);
   }
  1. Bound property
    1. Open Add property dialog
    2. Enter name and type
    3. Select Bound checkbox, and specify its name
    • EXPECTED RESULT: Besides the property itself another filed is added and setter is changed as in following code:
          
      
   public static final String PROP_PROP = "prop";
   public void setProp(String newprop) {
       String oldprop = prop;
       this.prop = newprop;
       propertyChangeSupport.firePropertyChange(PROP_PROP, oldprop, newprop);
   }
  1. Vetoable property
    1. Open Add property dialog
    2. Enter name and type
    3. Select Bound checkbox, specify its name and select Vetoable checkbox
    • EXPECTED RESULT: Besides the property itself another filed is added and setter is changed as in following code:
   public void setProp(String newprop) throws java.beans.PropertyVetoException {
       String oldprop = prop;
       vetoableChangeSupport.fireVetoableChange(PROP_PROP, oldprop, newprop);
       this.prop = newprop;
       propertyChangeSupport.firePropertyChange(PROP_PROP, oldprop, newprop);
   }


Test suite: Beans patterns recognition

  1. Single property
    1. Open empty class and select Beans Patterns in the combo-box in the Navigator window
    2. Manually add getter method
    3. Manually add setter method
    4. Modify getter/setter name, return type etc...
    • EXPECTED RESULT: The beans pattern is recognized in the Navigator, the type and name of property is correctly derived from methods name. The icon indicates if the property is read only, write only or read/write
  2. indexed property
    1. Open empty class and select Beans Patterns in navigator
    2. Manually add getter method for indexed property (e.g. method <TYPE> get<NAME>(int index) )
    3. Manually add setter method for indexed property (e.g. method void set<NAME>(<TYPE> value,int index) )
    4. Change names, return types and argument types
    5. Add getter/setter method for single property (<TYPE> get<NAME>() and void set<NAME>(<TYPE> value) )
    • EXPECTED RESULT: The index property is recognized properly, only indexed property is shown in navigator when both types of getter/setter are present



Test suite: Javadoc Index Search

Purpose:
Setup: Open project which uses library with attached javadoc.

  1. JDK class
    1. Open Javadoc index search (Shift-F1)
    2. Enter String and press enter
    3. Attach javadoc for default platform and repeat previous step
    • EXPECTED RESULT: If javadoc for platform is not attached, the search returns nothing (may return suitable elements from library). Once javadoc is attached, the result contains records for java.lang.String and other elements from JDK

Test suite: Show javadoc actions

Purpose: This suite test various ways how to get javadoc for given element
Setup: Open project using library with attached javadoc

  1. Show javadoc
    1. Put caret on some identifier in editor
    2. Call Show Javadoc action (from popupmenu or Alt-F1)
    • EXPECTED RESULT: Is source is available the javadoc is opened in external web browser, the page is scrolled to shown requested element. (e.g. when called on out on System.out.println() the page for java.lang.System is opened, scrolled to 'out' field)
  1. Javadoc view
    1. Open javadoc view
    2. Move cursor to several elements in editor
    • EXPECTED RESULT: Javadoc view show javadoc depending on current position of caret in the editor

Test suite: Generating javadoc for project

Setup: Create new project and fill in some javadoc (even for private elements

  1. Create javadoc
    1. From context menu on project select generate javadoc
    • EXPECTED RESULT: javadoc is generated in dist folder. It is opened in browser as well if this option it turned on

Test suite: Javadoc hints

Purpose: This suite test javadoc hints
Setup: Open any class in editor, turn on javadoc hint in Options -> Java Code -> Hints

  1. Generate javadoc
    1. Put caret on header of public method which does not have javadoc
    2. Use hint
    • EXPECTED RESULT: Javadoc stub is created, it has pre-filled @param, @throws and @return tags, matching the method header
  1. Correct javadoc - add
    1. Add parameter or exception to throws list in method which has correct javadoc
    2. Change return type from void to some type
    3. Use hint to correct javadoc
    • EXPECTED RESULT:Javadoc is updated
  1. Correct javadoc - remove
    1. Remove/rename some parameters, exceptions of change return type in the method header
    2. Apply hints which occurs in javadoc
    • EXPECTED RESULT: The related parts of javadoc is removed

Test suite: Javadoc abbreviation

  1. Generating method javadoc
    1. Put cater before method w/o javadoc (using generics)
    2. Type "/**" and press enter
    • EXPECTED RESULT: Javadoc stub is created, it contains all parameters, exceptions from throws clause and @return tag if it's non-void method.
  1. Class javadoc
    1. Put caret before class wih generics
    2. Type "/**" and press enter
    • EXPECTED RESULT: Javadoc containing @author and @param tags is generated

Test suite: Javadoc completion

Purpose: This suite is focused on completion in javadoc

  1. Param tag
    1. Put cursor inside empty javadoc for method public <T> T method(T i1, X i2) throws FileNotFoundException {
    2. Type @ and invoke javadoc completion if it isn't opened automatically
    3. select "param"
    4. invoke javadoc completion
    • EXPECTED RESULT: The completion in step 2 provides all suitable tags (deprecated, exception, param, return, see, serialData, since, throws ). In step 4 all params are provided (i1,i2, <T>)
  1. Param tag for class
    1. Put cursor inside empty javadoc for class public class Test<X>{
    2. Type @ and invoke javadoc completion if it isn't opened automatically
    3. select "param"
    4. invoke javadoc completion
    • EXPECTED RESULT: In step 2 following tags are provided: author, deprecated, param, see, serial, since, version. In step 4 the <X> parameter is provided
  1. Throws tag
    1. Put cursor inside empty javadoc for method public <T> T method(T i1, X i2) throws FileNotFoundException {
    2. Type @ and invoke javadoc completion if it isn't opened automatically
    3. select "throws"/"exception"
    4. invoke javadoc completion
    • EXPECTED RESULT: All subclass of Exception are listed. The class present in throws clause are at the beginning of the list
  1. {@ tags
    1. Put cursor inside empty javadoc for method,class or field
    2. Type {@ and invoke javadoc completion if it isn't opened automatically
    • EXPECTED RESULT: The following tags are provided: code, docRoot, link, linkPlain, literal. In addition it it there is also tag inheritDoc for methods and tag value for fields. The {@link and {@linkPlain tags behaves like @see

Test suite: Javadoc - javasource features

Purpose: This suite describes features from java source module which were extendet to work in javadoc
Setup: Open any class in editor,

  1. Add import
    1. In javadoc type "@see List"
    2. Call Fix Imports (ctrl-shift-I)
    • EXPECTED RESULT: Fix import dialog is opened, providing list of all classes named List in classpath. After confirm the correct class is imported.
  1. Resolve symbol
    1. Remove import for File from previous testcase
    2. Write {@link File# in javadoc
    3. Invoke code completion (ctrl-space)
    4. Impot java.io.File
    5. invoke code completion (ctrl-space) behind {@link File#
    • EXPECTED RESULT: No suggestion is returned as first invocation of code completion. As second invocation members of java.io.File are returned.
  1. Mark Occurrences
    1. Add @see or {@link or {@linkPlain and name of some class
    2. Import the class if it isn't already imported
    3. Put caret over class identifier
    • EXPECTED RESULT: Mark Occurrences works - all occurrences of class under cursor are highlighted
  1. Ctrl-navigation
    1. Ctrl-click on class name or method in @see, {@link or {@linkPlain tag
    • EXPECTED RESULT: The source file is opened if available

Test suite: Analyze Javadoc

Comments: Open attached project JavaDoc_STS_68_Java.zip. The Analyze javadoc action can be found in project view context menu Tools -> Analyze javadoc

  1. Analyze scope
    1. Select following elements in the project view
      1. whole source root
      2. package
      3. single file
    2. Call Analyze javadoc for each element
    • EXPECTED RESULT: The source files related to selected element are analyzed. And new window 'Analyzer' is opened, showing problems in javadoc.
  1. Browsing Javadoc errors
    1. Select source root
    2. Call Analyze Javadoc
    3. In Analyzer window press up/down button
    • EXPECTED RESULT: The highlighted line in Analyzer is moved to next/previous error. The cursor is moved to related element in editor. (File is opened if necessary)
  1. Fixing errors
    1. Analyze javadoc for some file.
    2. In Analyzer check 'Fix on next'
    3. Press Next button (down arrow)
    • EXPECTED RESULT: The highlighted line is moved to new error, the line is striked through and the javadoc is corrected, cursor it moved to editor to edit javadoc manually

Test suite: General indentation setting

Purpose:
Setup:

  1. Number of spaces per indent, right margin
    1. Open options dialog on proper tab.
    2. Select Language: All Languages, Category: Tabs And Indents
    3. Change 'Number Of Space per Indent' and 'Right Margin'
    4. Open all files Indentaiton.{java|html|xml} and reformat them
    • EXPECTED RESULT: The indentation is corrected to specified value, right margin is painted at correct position
  1. Expand tab to spaces, Tab size
    1. Open options dialog on proper tab.
    2. Select Language: All Languages, Category: Tabs And Indents
    3. Change 'Tab Size' and uncheck 'Expand tabs to spaces'
    4. Open all files indentaiton.{java|html|xml} and reformat them
    • EXPECTED RESULT: If there is N spaces in a row (where N is tab size) when invoking reformat, they are replace by one tab character. Tab key does not insert one tab char but tyies to add as many tab as it can, a the rest of space to the value of indentation level is filled with spaces. The spaces are never replaced by tab char when typing them manually.
  1. Tabs size, indentation level
    1. Open options dialog on proper tab.
    2. Select Language: All Languages, Category: Tabs And Indents
    3. Change 'Tab Size' and 'Number of Spaces per Indenr' to various values, keep 'Expand tabs to spaces' unchecked
    4. Open all files indentaiton.{java|html|xml} and reformat them after each change
    • EXPECTED RESULT: The spaces and tabs are inserted acording to notes in previous testcase result. Every time as many spaces as is possible is replaced by tabs,othervise the spaces are kept in code to get to appropriate indentation level.


Test suite: Tabs and indents

Purpose: This suite is focused on Java language formatting settings
Setup: Set default formatting setting before performing this suite

  1. Continuation indentation
    1. Open options dialog on proper tab.
    2. Select Language: Java, Category: Tabs And Indents
    3. Change 'Continuation Indentation Size'
    4. Open any java file and type (in scope where it makes sence:
      1. int i = <enter>
      2. public void <enter>
      3. public void metgod(int a, <enter>
      4. class <enter>
      5. int a = 3 <enter>
    • EXPECTED RESULT: The caret is moved to next line. The position of cursot is indentation level + continuation indentation
  1. Indent Top Level Class Members, Indent Case Statements
    1. Open options dialog on proper tab, Language: Java, Category: Tabs And Indents
    2. Uncheck 'Indent Top Level Class Members'
    3. Reformat class Indentation.java
    4. Open options dialog on proper tab, Language: Java, Category: Tabs And Indents
    5. Uncheck 'Indent Case Statement In Switch'
    6. Reformat class Indentation.java
    • EXPECTED RESULT: Whne first checkbox is unselected all class members (methods, fields, inner classes, initializers) are indented to begin at 1st column. (also in inner classes). When second checkbox is unselected the 'case' statements is indented to begin as the same position as related 'switch' statement
  1. Overriding default indentation settings
    1. Open options dialog on proper tab, Language: Java, Category: Tabs And Indents
    2. Check 'Override Global Options' and set new values for items which are enabled.
    3. Open Indentation.java and reformat it
    4. Open OD and uncheck 'Override Global Options' again
    • EXPECTED RESULT: The reformat in java respects entered values. Formatting in others files is unchanged. Once the global settings are not overrided the formatting settings is same in all files.


Test suite: Alignment

  1. New lines
    1. Open options dialog on proper tab, Language: Java, Category: Alignment
    2. Check all checkboxes in section New Lines
    3. Open Alignment.java and reformat it
    4. Open OD and uncheck all checboxes again
    • EXPECTED RESULT: New lines are inserted before 'void' in method declaration, else, while, catch and finally. Whne the checkbox are unchecked the newlines are removed again
  1. Multiline Alignment 1
    1. Open options dialog on proper tab, Language: Java, Category: Alignment
    2. Check all checkboxes in 1st column in section Multiline Alignment
    3. Open Alignment2.java and reformat it
    4. Open OD and uncheck all checboxes again
    • EXPECTED RESULT: The parameters in method declaration, arguments in annotations, exceptions behing throws, operands of binary operator , parts of assign statemen are indented that the identifiers stars at the same column. When the checkboxes are unchecked the value of continuation indentation is important again.
  1. Multiline Alignment 2
    1. Open options dialog on proper tab, Language: Java, Category: Alignment
    2. Check all checkboxes in 2st column in section Multiline Alignment
    3. Open Alignment3.java and reformat it
    4. Open OD and uncheck all checboxes again
    • EXPECTED RESULT: The arguments in method call, interfaces behing 'implements', array elements, parts of ternary operator, parts of for statements are indented that the identifiers stars at the same column. When the checkboxes are unchecked the value of continuation indentation is important again.


Test suite: Braces

  1. Position - Class
    1. Open options dialog on proper tab, Language: Java, Category: Braces
    2. In combobox 'Class Declaration' select values
      1. Same line
      2. New line
      3. New line half indented
      4. New line indented
    3. Open BracesPosition.java and reformat it
    • EXPECTED RESULT: The checkbox controls only position of class bracess, and the formatting is following 1) opening braces is behind class name, closing is at 1st column, 2) opening brace is at first column at a new line, closing is at 1st column, 3) opening and closing braces are as separated lines, indented by half value of intentation size, 4) opening and closing braces are indented by indentation size
  1. Position - Method
    1. Open options dialog on proper tab, Language: Java, Category: Braces
    2. In combobox 'Method declartion' select values
      1. Same line
      2. New line
      3. New line half indented
      4. New line indented
    3. Open BracesPosition.java and reformat it
    • EXPECTED RESULT: The checkbox controls only position of braces in method declarations, the position is described above
  1. Position - Other
    1. Open options dialog on proper tab, Language: Java, Category: Braces
    2. In combobox 'Other' select values
      1. Same line
      2. New line
      3. New line half indented
      4. New line indented
    3. Open BracesPosition.java and reformat it
    • EXPECTED RESULT: The checkbox controls only position of other types of braces - ifs, initializers, array initializers, block, synchronized blocks, lools, switch, the position where are braces moved is described above


Test suite: Wrapping

Comments: This suite tests the line wrapping, wrapping of each element can by set to 3 level: Never - the code construction is never wrapped, If long - the code is wrapped only if it exceeds right margin, Always - the code is always separated into new lines. To test this follow theses steps 1) open requested file, set mentioned rule to Always and reformat code, 2) undo changes, set right margin to 40 and set wrapping value to If Long, reformat code, 3) undo changes, set wrapping value to Never and reformat 4) set right margin back to 80

  1. Wrapping 1
    1. Open options dialog on proper tab, Language: Java, Category: Wrapping
    2. Open Wraping1.java
    3. Perform steps described in Comments with first half of the rules one by one - from Extend/Implements to ArrayInitializer
    • EXPECTED RESULT:
    • Extends/Implemtnes Keyword - break is added before extends/implements keyword (classes InnerClassWithQuiteALongName,InnerClassWithQuiteALongName)
    • Extends/Implemtnes list - break is added behind comma in list of implemented interfaces and behind implements/extends (classes Wrapping1,InnerClass)
    • Method parameters - break is added behind comma in list of parameters (method method(int,intStrng ...) )
    • Method call argument - break is added behind comma in method call (method method(int,intStrng ...) )
    • Annotation Arguments - behind opening brace or comma in annotation argument list (usage of MyAnnot)
    • Chained method Calls - behind period in row of method invocations (chained call of method method(int,intStrng ...))
    • Throws keyword - before throw keyword
    • Throws list - behind throw keyword of comma in the list of exceptions
    • Array Initializer - after opening '{' of after comma between array elements


Test suite: Blank lines

Comments: The testsuite focuses on controling number of blank lines between elements in java code. The number of empty spaces between element A and B is the bigger number from blank lines behind A and blank lines before B. The javadoc and inline comments counts as part of releated element. The blank lines inside methods body must stay untouched.

  1. Blank lines
    1. Open options dialog on proper tab, Language: Java, Category: Blank lines
    2. Try change each value one by one
    3. After entering new value, open EmptyLines.java and reformat it
    • EXPECTED RESULT: The number of blank lines respect entered values. How is computed exact number of empty lines is descibed in the comments


Test suite: Spaces

Comment: The Spaces formatting options controls entering spaces in various places. The name of eahc combobox is quite straiforward, so there is no need to describe separately in this test suite what it does.

  1. Spaces
    1. Open ClassA.java
    2. Open options dialog on proper tab, Language: Java, Category: Spaces
    3. Try change each value one by one
    4. After entering new value, open ClassA.java and reformat it
    • EXPECTED RESULT: The spaces are insrted to proper positons



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