FeaturesPluginsDocs & SupportCommunityPartners

Hints Test Specification

Author: Max Sauer
Version: 5.0
Last update: 07.09.2005
Introduction: This document serves as a test specification for Hints module.
Comment:

Inside of this test specification, there may appear following symbols:

  • -->: This stands for "Result:".
  • "|": Character "pipe" stands for carret position.

If you find some differences between results described in this document and your results then please fill an issue or send me an email.

Table of Contents

Test suite 1: Add Import

Purpose: Testing of "Add Import" Hints feature functionality.
Setup: Open prepared test project.

#Test caseDescription
1Simple Import
Setup:Open "AddImport.java".
  1. Place carret on line 16.
  2. Wait for the hint bulb to appear.
  3. Press "Alt-Enter" --> Add import for java.io.BufferedReader should appear.
  4. Press Enter --> import statement should be added.
  5. Place carret on line 19.
  6. Add import for Arraylist, this time using mouse click on the appeared hint bulb. --> import statement for ArrayList should be added.
Teardown: Close the file, discarding all changes.
RESULT:Both import statements were succesfully added. The block should be positioned between "package" statement and "@author" javadoc comment. An extra line should be added bellow the block.
2Multiple Choise
Setup:Open "AddImport.java".
  1. Place carret on line 21.
  2. Wait for the hint bulb to appear.
  3. Try to add import statements for both options.
  4. Repeat last two steps both for keyboard and mouse.
Teardown: Close the file, discarding all changes.
RESULT:Import statements were added. Block of import statements is well formatted.
3Exceptions
Setup:Open "obsah.java".
  1. Place carret on line 16.
  2. Wait for the hint bulb to appear. -->
  3. Try to add import statement for both exceptions thrown by that method.
  4. Hit Undo (Ctrl-Z) twice, so that both import statements disappear.
  5. Try to add them in reverse order.
  6. Delete one of the exceptions after the throws keyword.
  7. Place carret on line 16 once again; -->
Teardown: Close the file, discarding all changes.
RESULT:Every action have appropriate results: import statements are pasted, proper hint bulbs are displayed.

Test suite 2: Add Throws Clause

Purpose: Testing of "Add Throws Clause" Hints feature functionality.
Setup:

#Test caseDescription
1Single Add throws
Setup:Open "AddThrows.java" from test project.
  1. Place carret on line 22.
  2. Wait for the hint bulb to appear. -->
  3. Press Alt-E, wait for the dialog to appear.
  4. From the appeared dialog, choose the fist option -- "Add throws clause for java.io.FileNotFoundException".
Teardown: Close the file, discarding all changes.
RESULT:The Result should look like this:
2Multiple Add Throws
Setup:Open "AddThrows2.java" from test project.
  1. Place carret on line 25.
  2. Wait for the Hint bulb to appear.
  3. Click on the appeared bulb.
  4. In appeared dialog, choose the first option -- "Add throws clause for java.io.FileNotFoundException".
  5. Wait for the hint bulb to appear once again.
  6. In appeared dialog, choose the first option -- "Add throws clause for java.io.IOException".
Teardown: Close the file, discarding all changes.
RESULT:Both exceptions should be pasted in this order behinf the throws keywords, which should be added after the first "Add Throw Clouse" has been used.
The result should look like this:

Test suite 3: Cast Parameter

Purpose: Testing of "Cast Parameter" Hints feature functionality.
Setup: Open "Cast.java" from test project.

#Test caseDescription
1Type Cast
  1. Place carret on line 28.
  2. Wait for the Hint bulb to appear.
  3. Invoke the hint.
Teardown: Close the file, discarding all changes.
RESULT:"list.remove(0);" should be cast to "testCl". Error annotation should disappear.
2Cast To Subtype 1
  1. Place carret on line 32.
  2. Wait for the Hint bulb to appear.
  3. Invoke the hint.
RESULT:Object o is casted to String.
3Cast to Subtype 2
  1. Place carret on line 36.
  2. Wait for the Hint bulb to appear.
  3. Invoke the hint.
RESULT:In the return statement, Object o is casted to String.
Add Cast Hint is available at lines with compiler's error incompatible types. It covers missing cast statement in assignment (typically when getting element from list), incompatible type in local variable declaration and incompatible type of method return value type and return value statement.

Test suite 4: Implement Abstract Methods

Purpose: Testing of "Implement Abstract Methods" Hints feature functionality.
Setup: Open prepared test project in the IDE.

#Test caseDescription
1Abstract Class
Setup:Open "ImplementAllAbstract.java".
  1. Place carret on line 28.
  2. Invoke the "Implement all abstract methods" hint.
RESULT:Both abstract methods from class "Instrument" should be added to "Wind" class, with empty method bodies:
public void play()
public void tune()
2Simple synchronization test
  1. Add interface ifaces.RootInterface to an existing class, you can do this by 2 ways: by hand or using PropertySheet.
  2. Place carret on the class definition.
  3. Invoke appeared hint.
RESULT:All methods will be added into implementing class. Method bodies should be empty.
3Two interfaces
  1. Let your test java class implement 2 interfaces: ifaces.RootInterface and ifaces.OtherInterface.
  2. Place carret on the class definition.
  3. Invoke appeared hint.
RESULT:Methods from both interfaces(RootInterface and OtherInterface) should be added into implementing class.
4Derived interfaces
  1. Let your test java class implement ifaces.Interface1. Interface1 extends RootInterface.
  2. Place carret on the class definition.
  3. Invoke appeared hint.
RESULT:Methods from both interfaces(RootInterface and Interface1) should be added into implementing class
5Two interfaces extends the same ancestor
  1. Let your test java class implement Interface1 and Interface2. Don't forget to add import ifaces.*; statement.
  2. Place carret on the class definition.
  3. Invoke appeared hint.
RESULT:Methods from both interfaces(Interface1 and Interface2) should be added into implementing class.
6Interface hierarchy has the same ancestor
  1. Let your test java class implement Interface4. Interface4 extends Inteface1 and Interface2.
  2. Place carret on the class definition.
  3. Invoke appeared hint.
RESULT:Methods from Interface4, Interface1 and Interface2 should be added into implementing class
7Mode 'Generate Exception'
  1. Go to Tools | Options | Classic View | Editing | Java Sources | Override Methods. Change Return generation mode to "Generate Exception".
  2. Verify this using some of the above usecases.
RESULT:All generated methods should have throw new UnsupportedOperationException(); in it's body
8Mode 'return null'
  1. Go to Tools | Options | Classic View | Editing | Java Sources | Override Methods. Change Return generation mode to "return null".
  2. Verify this using some of the above usecases.
RESULT:All generated methods should return 'null'. E.g. for int '0' is generated, for String null, for boolean false etc.

Test suite 5: Unresolved Element

Purpose: Testing of "Unresolved Element" Hints feature functionality.
Setup:

#Test caseDescription
1Create Field on a class
Setup:Open "unresElement.java" from test project.
  1. Place carret on line 18.
  2. Click the appeared HintBulb.
  3. From the appeared list, choose the first option --> "Create field a on hints_testproject.unreElement"
Teardown: Close the file, discarding all changes.
RESULT:Inside of "unresElement" class, new field should be added, named a. It should be a private int, and the int keyword should be highlighted.
2Create Method's Parameter
Setup:Open "unresElement.java" once again.
  1. Place carret on line 18.
  2. Click the appeared HintBulb.
  3. From the appeared list, choose the second option --> "Create parameter a".
  4. Place carret on line 24.
  5. Repeat step 3.
Teardown: Close the file, discarding all changes.
RESULT:Both method's should have new parameter properly added -- "int a".
3Create Local Variable
Setup:Open "unresElement.java" once again.
  1. Place carret on line 18.
  2. Click the appeared HintBulb.
  3. From the appeared list, choose the third option --> "Create local variable a".
Teardown: Close the file, discarding all changes.
RESULT:New local variable should be added to the method's body.
4Create method 1
Setup:Open "CreateMethod.java".
  1. Place carret on line 20.
  2. Invoke the hint.
RESULT:New method
private StringBuffer assignStringBuffer()
should be created, returning null.
5Create method 2
  1. Place carret on line 25.
  2. Invoke the hint.
RESULT:New method
private int assignInteger()
should be created, returning 0.

Test suite 6: Initialize Variable

Purpose: Testing of "Initialize Variable" Hints feature functionality.
Setup:

#Test caseDescription
1Numerical Types
Setup:Open "InitVar.java" from test project.
  1. Place carret on line 22.
  2. Invoke the hint.
  3. Place carret on line 28.
  4. Invoke the hint.
RESULT:Both i and d should be initialized to zero.
2Objects
  1. Place carret on line 37.
  2. Invoke the hint.
RESULT:Object o should be initialized to null.

Test suite 7: Surround with try-catch

Purpose: Testing of "Surround with try-catch" Hints feature functionality.
Setup:

#Test caseDescription
1Surround
Setup:Open "Surround.java".
  1. Place carret on line 25.
  2. Click the appeared HintBulb.
  3. Choose the "Surround with try-catch" option.
  4. Place carret on line 25.
  5. Repeat steps 2 and 3.
Teardown: Close the file, discarding all changes.
RESULT:Both exceptions should be properly surrounded (java.io.FileNotFoundException, java.io.IOException). Import statements for both exceptions should be added.
The result should look like this:

Generated: 2005 09 07 04:26
Companion
Projects:
MySQL Database Server   Open JDK: an Open SourceJDK   GlassFish Community: an Open Source Application Server    Mobile & Embedded Community    Open Solaris   java.net - The Source for Java Technology Collaboration   Virtual Box - full virtualizer  Open ESB - The Open Enterprise Service Bus Powered by