Start adding a method by typing the following at the end of the VectorTest.java file (but before the closing
brackets of the type) in the Java editor: public void testSizeIsThree()
As soon as you type the method name in the editor area, the new method appears at the bottom of the Outline view.
In addition, error annotations (red boxes) appear in the overview ruler positioned on the right hand side
of the editor. These error annotations indicate that the compilation unit is currently not correct. If you hover
over the second red box, a tool tip appears: Unmatched bracket; Syntax error on token ")",
{ expected after this token, which is correct since the method doesn't have a body yet. Note that error
annotations in the editor's rulers are updated as you type. This behavior can be controlled via the
Report problems as you type option located on the preference page Java >
Editor.
Click the Save button. The compilation unit is compiled automatically and errors appear in the
Package Explorer view, in the Problems view and on the vertical ruler (left hand side of the editor). In the Package
Explorer view, the errors are propagated up to the project of the compilation unit containing the error.
Complete the new method by typing the following:
{
assertTrue(fFull.size() == 3);
Note that the closing curly bracket has been auto inserted.
Save the file. Notice that the error indicators disappear since the
missing bracket has been added.