Test Plan
All tests are run on the same badly formatted file found at http://wiki.csc.calpoly.edu/Twain/attachment/wiki/SystemTestPlan/Test.java . Each of the input and expected output code examples have line numbers that correspond with the badly formatted source code.
Initial Setup
1.) Click on the link to the right to get the testing source code. http://wiki.csc.calpoly.edu/Twain/attachment/wiki/SystemTestPlan/Test.java
2.) Save the code to an easily accessed spot on your computer
3.) Open BlueJ
4.) Under the Project Menu select "New Project", name it TestForm, click "Create"
5.) Under the Edit Menu select "Add Class From File..."
6.) Select the file you saved in step 2
Test #1-#2: Array Type Style
Requirement Traceability:
User Manual Section 2.1
Purpose:
This feature maintains consistent array initializing through out the source code.
Procedure:
Test #1:
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Misc". (4.) In the corresponding panel that appears on the right side of the window click "Array Brackets after identifer" check box. (5.) Click Ok. (6.) Right click on the test class image. (7.) Select FixStyle then click Format.
Test #2:
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Misc". (4.) In the corresponding panel that appears on the right side of the window unclick "Array Brackets after identifer" check box. (5.) Click Ok. (6.) Right click on the test class image. (7.) Select FixStyle then click Format.
Test Data:
INPUT
16 private int x;
17 private String [] str;
18 private int example[]= { 1,
19 2
20 };
Test #1: After Identifier
EXPECTED OUTPUT
16 private int x;
17 private String str[];
18 private int example[]= { 1,
19 2
20 };
Test #2: Before Identifier
EXPECTED OUTPUT
16 private int x;
17 private String[] str;
18 private int[] example= { 1,
19 2
20 };
Test #3: Inline Conditional
Requirement Traceability:
User Manual section 2.2
Purpose:
This feature replaces inline conditionals with if else statements for easier reading of the source code.
Procedure:
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Misc". (4.) In the corresponding panel that appears on the right side of the window click "Remove Inline Conditionals" check box. (5.) Click Ok. (6.) Right click on the test class image. (7.) Select FixStyle then click Format.
Test Data:
INPUT
46 return (x>3 || x <0) ? x : y;
EXPECTED OUTPUT
46 if (x> 3 || x<0){
47 return x;
48 } else {
49 return y;
50 }
Test #4: Default Comes Last
Requirement Traceability:
User Manual section 2.3
Purpose:
This feature makes sure that in switch statements the default case is the last option.
Procedure:
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Misc". (4.) In the corresponding panel that appears on the right side of the window click "Default Comes Last" check box. (5.) Click Ok. (6.) Right click on the test class image. (7.) Select FixStyle then click Format.
Test Data:
INPUT
48 private boolean someMethod (int y, int z) {
49 switch (z)
50 {
51 case 1: y=z; break;
52 default: x=2; break;
53 case 2: z=x; break;
54 }return true;}
EXPECTED OUTPUT
48 private boolean someMethod (int y, int z) {
49 switch (z)
50 {
51 case 1: y=z; break;
52 case 2: z=x; break;
53 default: x=2; break;
54 }return true;}
Test #5-#8: Curly Braces
Requirement Traceability:
User Manual section 2.4
Purpose:
This function adjusts the curly braces for blocks that use curly braces.
Procedure:
Test #5: Newline before left brace
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Braces". (4.) In the corresponding panel that appears on the right side of the window click the "Custom style" check box. (5.) Click the "Newline before left brace" check box. (6.) Set the white space accordingly: 0 for "Before left brace", 0 for "Before right brace", and 1 for "After right brace." (7.) Click Ok. (8.) Right click on the test class image. (9.) Select FixStyle then click Format.
Test #6: Newline after right brace
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Braces". (4.) In the corresponding panel that appears on the right side of the window click the "Custom style" check box. (5.) Click the "Newline after right brace" check box. (6.) Set the white space accordingly: 0 for "Before left brace", 0 for "Before right brace", and 1 for "After right brace." (7.) Click Ok. (8.) Right click on the test class image. (9.) Select FixStyle then click Format.
Test #7: Treat class/method blocks different
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Braces". (4.) In the corresponding panel that appears on the right side of the window click the "Treat class/method blocks different" check box. (5.) Click Ok. (6.) Right click on the test class image. (7.) Select FixStyle then click Format.
Test #8: Treat class/method blocks different if wrapped
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Braces". (4.) In the corresponding panel that appears on the right side of the window click the "Treat class/method blocks different if wrapped" check box. (5.) Click Ok. (6.) Right click on the test class image. (7.) Select FixStyle then click Format.
Test Data:
INPUT
66 static private class internal{
67 internal(){
68 }
69 }
70 private int
71 incX(){
72 x=3;
73 for(int i=0; i<20; i++){
74 x=i*2;
75 }return x;
76 }
Test #5: Newline before left brace
EXPECTED OUTPUT
66 static private class internal
67 {
68 internal()
69 {
70 }
71 }
72 private int
73 incX()
74 {
75 x=3;
76 for(int i=0; i<20; i++)
77 {
78 x=i*2;
79 } return x;
80 }
Test #6: Newline after right brace
EXPECTED OUTPUT
66 static private class internal{
67 internal(){
68 }
69 }
70 private int
71 incX(){
72 x=3;
73 for(int i=0; i<20; i++){
74 x=i*2;
75 }
76 return x;
77 }
Test #7: Treat class/method blocks different
EXPECTED OUTPUT
66 static private class internal
67 {
68 internal()
69 {
70 }
71 }
72 private int
73 incX()
74 {
75 x=3;
76 for(int i=0; i<20; i++){
77 x=i*2;
78 } return x;
79 }
Test #8: Treat class/method blocks different if wrapped
EXPECTED OUTPUT
66 static private class internal{
67 internal(){
68 }
69 }
70 private int
71 incX()
72 {
73 x=3;
74 for(int i=0; i<20; i++){
75 x=i*2;
76 } return x;
77 }
Test #9: Line Length
Requirement Traceability:
User Manual section 2.6
Purpose:
This function limits the length of the lines in the source code file(s) run on.
Procedure:
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Wrapping". (4.) In the corresponding panel that appears on the right side of the window select the "General" tab. (5.) Click the "Wrap Line" check box and select 80 from the Line length: drop down menu. (6.) In the Policy box check all options, except "Wrap before operators". (7.) Click OK. (8.) Right click on the test class image. (9.) Select FixStyle then click Format.
Test Data:
INPUT
28 public Test(int firstVeryLongParameter, String secondVeryLongParameter, boolean thirdVeryLongParameter)
EXPECTED OUTPUT
28 public Test(int firstVeryLongParameter, 29 String secondVeryLongParameter, 30 boolean thirdVeryLongParameter)
Test #10- #12: Method Paren Pad
Requirement Traceability:
User Manual section 2.7
Purpose:
This function maintains consistent spacing for method parentheses declarations through out the source code.
Procedure:
Test #10: No Space
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "White Space". (4.) In the corresponding panel that appears on the right side of the window unclick "Method declaration parentheses" check box and unclick "Method call parentheses" checkbox. (5.) Click Ok. (6.) Right click on the test class image. (7.) Select FixStyle then click Format.
Test #11: One Space
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "White Space". (4.) In the corresponding panel that appears on the right side of the window click "Method declaration parentheses" check box and click the "Method call parentheses" checkbox. (5.) Click Ok. (6.) Right click on the test class image. (7.) Select FixStyle then click Format.
Test #12: New Line
(1.) Select the Tools Menu and click "FixStylePreferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Wrapping". (4.) In the corresponding panel that appears on the right side of the window select the "Always" tab. (5.) In the section Wrap always click "Method left parentheses" checkbox. (6.) Click Ok. (7.) Right click on the test class image. (8.) Select FixStyle then click Format.
Test Data:
INPUT
39 public int sampleMethod( int y)
48 private boolean someMethod (int y, int z) {
55 private void anotherMethod( )
63 public String somethingElse ( int a , int b, int c )
Test #10: No Space
EXPECTED OUTPUT
39 public int sampleMethod( int y)
48 private boolean someMethod(int y, int z) {
55 private void anotherMethod( )
63 public String somethingElse( int a , int b, int c )
Test #11: One Space
EXPECTED OUTPUT
39 public int sampleMethod ( int y)
48 private boolean someMethod (int y, int z) {
55 private void anotherMethod ( )
63 public String somethingElse ( int a , int b, int c )
Test #12: New Line
EXPECTED OUTPUT
39 public int sampleMethod
40 ( int y)
49 private boolean someMethod
50 (int y, int z) {
57 private void anotherMethod
58 ( )
66 public String somethingElse
67 ( int a , int b, int c )
Test #13: Multiple Variable Declaration
Requirement Traceability:
User Manual section 2.8
Purpose:
Declaring variables on their own lines allows easier reading of the code and room for comments of why the variables are there.
Procedure:
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Misc". (4.) In the corresponding panel that appears on the right side of the window click the "Remove inline conditionals" check box. (5.) Click Ok. (6.) Right click on the test class image. (7.) Select FixStyle then click Format.
Test Data:
INPUT
21 private boolean bool1, bool2, b;
55 private void anotherMethod( )
56 {
57 int x = 2, y = 3;
EXPECTED OUTPUT
21 private boolean bool1;
22 private boolean bool2;
23 private boolean b;
55 private void anotherMethod( )
56 {
57 int x = 2;
58 int y = 3;
Test #14: Single Line Braces
Requirement Traceability:
User Manual section 2.9
Purpose:
Inserting braces around statements that are only one line long creates easier readability of the code and less errors when the code is added to if the parameters are already there.
Procedure:
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Braces". (4.) In the corresponding panel that appears on the right side of the window select the Misc Tab. (5.) Under the Insert braces section click the "if...else" check box, the "for" checkbox, the "while" checkbox, and the "do...while" checkbox. (6.) Click Ok. (7.) Right click on the test class image. (8.) Select FixStyle then click Format.
Test Data:
INPUT
58 if(x==3) 59 y++; 60 else 61 x++;
EXPECTED OUTPUT
58 if(x==3)
59 {
60 y++;
61 }
62 else
63 {
64 x++;
65 }
Test #15- #16: Paren Pad
Requirement Traceability:
User Manual section 2.10
Purpose:
This function ensure uniform parenthesis padding with the options of having no space or one space around the parenthesis.
Procedure:
Test #15: Spaces
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Braces". (4.) In the corresponding panel that appears on the right side of the window select the "General" tab. (5.) In the Styles box click "Custom style" check box. (6.) In the "White Space" box select '1' from the "Before left brace:" drop down menu and '1' from the "Before right brace:" drop down menu.(7.) Click Ok. (8.) Right click on the test class image. (9.) Select FixStyle then click Format.
Test #16: No Spaces
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Braces". (4.) In the corresponding panel that appears on the right side of the window select the "General" tab. (5.) In the Styles box click "Custom style" check box. (6.) In the "White Space" box select '0' from the "Before left brace:" drop down menu and '0' from the "Before right brace:" drop down menu.(7.) Click Ok. (8.) Right click on the test class image. (9.) Select FixStyle then click Format.
Test Data:
INPUT
27 public Test(){ x=0; } public Test(int z) { x=z; }
28 public Test(int firstVeryLongParameter, String secondVeryLongParameter, boolean thirdVeryLongParameter)
29 { x=
30 firstVeryLongParameter;
31 str[0] = secondVeryLongParameter; }
32
33 /**
34 * An example of a method - replace this comment with your own
35 *
36 * @param y a sample parameter for a method
37 * @return the sum of x and y
38 */
39 public int sampleMethod( int y)
40 {
41 while(y!=0) y--;
42 y=2;
43 while (y>0){ y= x-1; x--; } y=2;
44 do{ x++;}while(x<100);
45
46 return (x>3 || x <0) ? x : y;
47 }
48 private boolean someMethod (int y, int z) {
49 switch (z)
50 {
51 case 1: y=z; break;
52 default: x=2; break;
53 case 2: z=x; break;
54 }return true;}
55 private void anotherMethod( )
56 {
57 int x=2, y=3;
58 if(x==3)
59 y++;
60 else
61 x++;
62 try{ x=3; } catch(Exception e){System.out.println("Hello\n");} finally{x=2;} x++;}
63 public String somethingElse ( int a , int b, int c )
64 { String s="yes"; a=b+c; return s;}
65
66 static private class internal{
67 internal() {
68 }
69 }
70 private int
71 incX(){
72 x=3;
73 for(int i=0; i<20; i++){
74 x=i*2;
75 }return x;
76 }
77
78 }
Test #15: Spaces
EXPECTED OUTPUT
27 public Test(){ x=0; } public Test( int z ) { x=z; }
28 public Test( int firstVeryLongParameter, String secondVeryLongParameter, boolean thirdVeryLongParameter )
29 { x=
30 firstVeryLongParameter;
31 str[0] = secondVeryLongParameter; }
32
33 /**
34 * An example of a method - replace this comment with your own
35 *
36 * @param y a sample parameter for a method
37 * @return the sum of x and y
38 */
39 public int sampleMethod( int y )
40 {
41 while(y!=0) y--;
42 y=2;
43 while (y>0){ y= x-1; x--; } y=2;
44 do{ x++;}while(x<100);
45
46 return (x>3 || x <0) ? x : y;
47 }
48 private boolean someMethod ( int y, int z ) {
49 switch (z)
50 {
51 case 1: y=z; break;
52 default: x=2; break;
53 case 2: z=x; break;
54 }return true;}
55 private void anotherMethod( )
56 {
57 int x=2, y=3;
58 if(x==3)
59 y++;
60 else
61 x++;
62 try{ x=3; } catch( Exception e ){System.out.println("Hello\n");} finally{x=2;} x++;}
63 public String somethingElse ( int a , int b, int c )
64 { String s="yes"; a=b+c; return s;}
65
66 static private class internal{
67 internal ( ) {
68 }
69 }
70 private int
71 incX ( ){
72 x=3;
73 for(int i=0; i<20; i++){
74 x=i*2;
75 }return x;
76 }
77
78 }
Test #16: No Spaces
EXPECTED OUTPUT
27 public Test(){ x=0; } public Test(int z) { x=z; }
28 public Test(int firstVeryLongParameter, String secondVeryLongParameter, boolean thirdVeryLongParameter)
29 { x=
30 firstVeryLongParameter;
31 str[0] = secondVeryLongParameter; }
32
33 /**
34 * An example of a method - replace this comment with your own
35 *
36 * @param y a sample parameter for a method
37 * @return the sum of x and y
38 */
39 public int sampleMethod(int y)
40 {
41 while(y!=0) y--;
42 y=2;
43 while (y>0){ y= x-1; x--; } y=2;
44 do{ x++;}while(x<100);
45
46 return (x>3 || x <0) ? x : y;
47 }
48 private boolean someMethod(int y, int z) {
49 switch(z)
50 {
51 case 1: y=z; break;
52 default: x=2; break;
53 case 2: z=x; break;
54 }return true;}
55 private void anotherMethod( )
56 {
57 int x=2, y=3;
58 if(x==3)
59 y++;
60 else
61 x++;
62 try{ x=3; } catch(Exception e){System.out.println("Hello\n");} finally{x=2;} x++;}
63 public String somethingElse(int a , int b, int c)
64 { String s="yes"; a=b+c; return s;}
65
66 static private class internal{
67 internal() {
68 }
69 }
70 private int
71 incX(){
72 x=3;
73 for(int i=0; i<20; i++){
74 x=i*2;
75 }return x;
76 }
77
78 }
Test #17: Tabs to Spaces
Requirement Traceability:
User Manual section 2.11
Purpose:
This function changes tabs to spaces so that when moving code from one IDE to another the formatting will not be altered depending on the tab settings in that environment.
Procedure:
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Indentation". (4.) In the corresponding panel that appears on the right side of the window select the "Misc" tab. (5.) Unclick "Use tabs to indent" check box. (5.) Click Ok. (6.) Right click on the test class image. (7.) Select FixStyle then click Format.
Test Data:
INPUT
9 import java.util.*;
10 import java.lang.*;
11 import java.lang.reflect.*;
12
13 public class Test
14 {
15 // instance variables - replace the example below with your own
16 private int x;
17 private String [] str;
18 private int example[]= { 1,
19 2
20 };
21 private boolean bool1, bool2, b;
22
23
24 /**
25 * Constructor for objects of class Test
26 */
27 public Test(){ x=0; } public Test(int z) { x=z; }
28 public Test(int firstVeryLongParameter, String secondVeryLongParameter, boolean thirdVeryLongParameter)
29 { x=
30 firstVeryLongParameter;
31 str[0] = secondVeryLongParameter; }
32
33 /**
34 * An example of a method - replace this comment with your own
35 *
36 * @param y a sample parameter for a method
37 * @return the sum of x and y
38 */
39 public int sampleMethod( int y)
40 {
41 while(y!=0) y--;
42 y=2;
43 while (y>0){ y= x-1; x--; } y=2;
44 do{ x++;}while(x<100);
45
46 return (x>3 || x <0) ? x : y;
47 }
48 private boolean someMethod (int y, int z) {
49 switch (z)
50 {
51 case 1: y=z; break;
52 default: x=2; break;
53 case 2: z=x; break;
54 }return true;}
55 private void anotherMethod( )
56 {
57 int x=2, y=3;
58 if(x==3)
59 y++;
60 else
61 x++;
62 try{ x=3; } catch(Exception e){System.out.println("Hello\n");} finally{x=2;} x++;}
63 public String somethingElse ( int a , int b, int c )
64 { String s="yes"; a=b+c; return s;}
65
66 static private class internal{
67 internal() {
68 }
69 }
70 private int
71 incX(){
72 x=3;
73 for(int i=0; i<20; i++){
74 x=i*2;
75 }return x;
76 }
77
78 }
EXPECTED OUTPUT
9 import java.util.*;
10 import java.lang.*;
11 import java.lang.reflect.*;
12
13 public class Test
14 {
15 // instance variables - replace the example below with your own
16 private int x;
17 private String [] str;
18 private int example[]= { 1,
19 2
20 };
21 private boolean bool1, bool2, b;
22
23
24 /**
25 * Constructor for objects of class Test
26 */
27 public Test(){ x=0; } public Test(int z) { x=z; }
28 public Test(int firstVeryLongParameter, String secondVeryLongParameter, boolean thirdVeryLongParameter)
29 { x=
30 firstVeryLongParameter;
31 str[0] = secondVeryLongParameter; }
32
33 /**
34 * An example of a method - replace this comment with your own
35 *
36 * @param y a sample parameter for a method
37 * @return the sum of x and y
38 */
39 public int sampleMethod( int y)
40 {
41 while(y!=0) y--;
42 y=2;
43 while (y>0){ y= x-1; x--; } y=2;
44 do{ x++;}while(x<100);
45
46 return (x>3 || x <0) ? x : y;
47 }
48 private boolean someMethod (int y, int z) {
49 switch (z)
50 {
51 case 1: y=z; break;
52 default: x=2; break;
53 case 2: z=x; break;
54 }return true;}
55 private void anotherMethod( )
56 {
57 int x=2, y=3;
58 if(x==3)
59 y++;
60 else
61 x++;
62 try{ x=3; } catch(Exception e){System.out.println("Hello\n");} finally{x=2;} x++;}
63 public String somethingElse ( int a , int b, int c )
64 { String s="yes"; a=b+c; return s;}
65
66 static private class internal{
67 internal() {
68 }
69 }
70 private int
71 incX(){
72 x=3;
73 for(int i=0; i<20; i++){
74 x=i*2;
75 }return x;
76 }
77
78 }
Test #18: Whitespace Around
Requirement Traceability:
User Manual section 2.12
Purpose:
This function puts a white space around each variable and arithmetic symbols to increase the readability of the source code.
Procedure:
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "White Space". (4.) In the corresponding panel that appears on the right side of the window click the check boxes labeled: "Assignment operators", "Bitwise Operators", "Logical operators", "Mathematical operators", "Relational operators", "Shift Operators" and "Type cast parentheses" . (5.) Click Ok. (6.) Right click on the test class image. (7.) Select FixStyle then click Format.
Test Data:
INPUT
27 public Test(){ x=0; } public Test(int z) { x=z; }
28 public Test(int firstVeryLongParameter, String secondVeryLongParameter, boolean thirdVeryLongParameter)
29 { x=
30 firstVeryLongParameter;
31 str[0] = secondVeryLongParameter; }
32
33 /**
34 * An example of a method - replace this comment with your own
35 *
36 * @param y a sample parameter for a method
37 * @return the sum of x and y
38 */
39 public int sampleMethod( int y)
40 {
41 while(y!=0) y--;
42 y=2;
43 while (y>0){ y= x-1; x--; } y=2;
44 do{ x++;}while(x<100);
45
46 return (x>3 || x <0) ? x : y;
47 }
48 private boolean someMethod (int y, int z) {
49 switch (z)
50 {
51 case 1: y=z; break;
52 default: x=2; break;
53 case 2: z=x; break;
54 }return true;}
55 private void anotherMethod( )
56 {
57 int x=2, y=3;
58 if(x==3)
59 y++;
60 else
61 x++;
62 try{ x=3; } catch(Exception e){System.out.println("Hello\n");} finally{x=2;} x++;}
63 public String somethingElse ( int a , int b, int c )
64 { String s="yes"; a=b+c; return s;}
65
66 static private class internal{
67 internal() {
68 }
69 }
70 private int
71 incX(){
72 x=3;
73 for(int i=0; i<20; i++){
74 x=i*2;
75 }return x;
76 }
77
78 }
EXPECTED OUTPUT
27 public Test(){ x = 0; } public Test(int z) { x = z; }
28 public Test(int firstVeryLongParameter, String secondVeryLongParameter, boolean thirdVeryLongParameter)
29 { x =
30 firstVeryLongParameter;
31 str[0] = secondVeryLongParameter; }
32
33 /**
34 * An example of a method - replace this comment with your own
35 *
36 * @param y a sample parameter for a method
37 * @return the sum of x and y
38 */
39 public int sampleMethod( int y)
40 {
41 while(y != 0) y--;
42 y = 2;
43 while (y > 0){ y = x - 1; x--; } y = 2;
44 do{ x++;}while(x < 100);
45
46 return (x > 3 || x < 0) ? x : y;
47 }
48 private boolean someMethod (int y, int z) {
49 switch (z)
50 {
51 case 1: y = z; break;
52 default: x = 2; break;
53 case 2: z = x; break;
54 }return true;}
55 private void anotherMethod( )
56 {
57 int x = 2, y = 3;
58 if(x == 3)
59 y++;
60 else
61 x++;
62 try{ x = 3; } catch(Exception e){System.out.println("Hello\n");} finally{ x = 2;} x++;}
63 public String somethingElse ( int a , int b, int c )
64 { String s = "yes"; a = b + c; return s;}
65
66 static private class internal{
67 internal() {
68 }
69 }
70 private int
71 incX(){
72 x = 3;
73 for(int i = 0; i < 20; i++){
74 x = i * 2;
75 }return x;
76 }
77
78 }
Test #19: Newline at End of File
Requirement Traceability:
User Manual section 2.13
Purpose:
This function is meant to check that the end of the file has an new line character to end it
Procedure:
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Misc". (4.) In the corresponding panel that appears on the right side of the window click "Insert trailing newline" check box. (5.) Click Ok. (6.) Right click on the test class image. (7.) Select FixStyle then click Format.
Test Data:
INPUT
66 static private class internal{
67 internal() {
68 }
69 }
70 private int
71 incX(){
72 x=3;
73 for(int i=0; i<20; i++){
74 x=i*2;
75 }return x;
76 }
77
78 }
EXPECTED OUTPUT
66 static private class internal{
67 internal() {
68 }
69 }
70 private int
71 incX(){
72 x=3;
73 for(int i=0; i<20; i++){
74 x=i*2;
75 }return x;
76 }
77
78 }
79
Test #20: Redundant Import
Requirement Traceability:
User Manual section 2.14
Purpose:
This function eliminates any imports that have already been imported in that file. This increases the speed of the program so the same library is not accessed twice when unneeded.
Procedure:
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Imports". (4.) In the corresponding panel that appears on the right side of the window click "Remove redundant imports" check box. (5.) Click Ok. (6.) Right click on the test class image. (7.) Select FixStyle then click Format.
Test Data:
INPUT
9 import java.util.*; 10 import java.lang.*; 11 import java.lang.reflect.*;
EXPECTED OUTPUT
9 import java.util.*; 10 import java.lang.*;
Test #21: Array Trailing Comma
Requirement Traceability:
User Manual section 2.15
Purpose:
This function adds a trailing comma to array initializations in order to maintain consistency through out the source code.
Procedure:
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Misc". (4.) In the corresponding panel that appears on the right side of the window click "Array trailing comma" check box. (5.) Click Ok. (6.) Right click on the test class image. (7.) Select FixStyle then click Format.
Test Data:
INPUT
18 private int example[]= { 1,
19 2
20 };
EXPECTED OUTPUT
18 private int example[]= { 1,
19 2,
20 };
Test #22: Enforce Javadocs
Requirement Traceability:
User Manual section 2.16
Purpose:
This function makes sure that each class, method, and constructor has a javadoc associated with it in order to ensure that the source code is properly documented.
Procedure:
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Javadoc". (4.) In the corresponding panel that appears on the right side of the window select the "General" tab. (5.) In the "Generation" box click all of the check boxes for each of the Classes/Interface, Constructors, Methods, and Variables. (6.) Click the "Include inner classes" check box. (7.) Click Ok. (8.) Right click on the test class image. (9.) Select FixStyle then click Format.
Test Data:
INPUT
2 /**
3 * This document is meant to include an example of all the different cases that
4 * the formatter needs to be able to change.
5 *
6 * @author Jamie Ray
7 * @version 1.0
8 */
9 import java.util.*;
10 import java.lang.*;
11 import java.lang.reflect.*;
12
13 public class Test
14 {
15 // instance variables - replace the example below with your own
16 private int x;
17 private String [] str;
18 private int example[]= { 1,
19 2
20 };
21 private boolean bool1, bool2, b;
22
23
24 /**
25 * Constructor for objects of class Test
26 */
27 public Test(){ x=0; } public Test(int z) { x=z; }
28 public Test(int firstVeryLongParameter, String secondVeryLongParameter, boolean thirdVeryLongParameter)
29 { x=
30 firstVeryLongParameter;
31 str[0] = secondVeryLongParameter; }
32
33 /**
34 * An example of a method - replace this comment with your own
35 *
36 * @param y a sample parameter for a method
37 * @return the sum of x and y
38 */
39 public int sampleMethod( int y)
40 {
41 while(y!=0) y--;
42 y=2;
43 while (y>0){ y= x-1; x--; } y=2;
44 do{ x++;}while(x<100);
45
46 return (x>3 || x <0) ? x : y;
47 }
48 private boolean someMethod (int y, int z) {
49 switch (z)
50 {
51 case 1: y=z; break;
52 default: x=2; break;
53 case 2: z=x; break;
54 }return true;}
55 private void anotherMethod( )
56 {
57 int x=2, y=3;
58 if(x==3)
59 y++;
60 else
61 x++;
62 try{ x=3; } catch(Exception e){System.out.println("Hello\n");} finally{x=2;} x++;}
63 public String somethingElse ( int a , int b, int c )
64 { String s="yes"; a=b+c; return s;}
65
66 static private class internal{
67 internal() {
68 }
69 }
70 private int
71 incX(){
72 x=3;
73 for(int i=0; i<20; i++){
74 x=i*2;
75 }return x;
76 }
77
78 }
EXPECTED OUTPUT
2 /**
3 * This document is meant to include an example of all the different cases that
4 * the formatter needs to be able to change.
5 *
6 * @author Jamie Ray
7 * @version 1.0
8 */
9 import java.util.*;
10 import java.lang.*;
11 import java.lang.reflect.*;
12
13 public class Test
14 {
15 // instance variables - replace the example below with your own
16 private int x;
17 private String [] str;
18 private int example[]= { 1,
19 2
20 };
21 private boolean bool1, bool2, b;
22
23
24 /**
25 * Constructor for objects of class Test
26 */
27 public Test(){ x=0; } public Test(int z) { x=z; }
28 /**
29 * Write a description for constructor for objects of class Test
30 *
31 */
32 public Test(int firstVeryLongParameter, String secondVeryLongParameter, boolean thirdVeryLongParameter)
33 { x=
34 firstVeryLongParameter;
35 str[0] = secondVeryLongParameter; }
36
37 /**
38 * An example of a method - replace this comment with your own
39 *
40 * @param y a sample parameter for a method
41 * @return the sum of x and y
42 */
43 public int sampleMethod( int y)
44 {
45 while(y!=0) y--;
46 y=2;
47 while (y>0){ y= x-1; x--; } y=2;
48 do{ x++;}while(x<100);
49
50 return (x>3 || x <0) ? x : y;
51 }
52 /**
53 * Write a description of method someMethod here.
54 *
55 * @param y
56 * @param z
57 * @return
58 */
59 private boolean someMethod (int y, int z) {
60 switch (z)
61 {
62 case 1: y=z; break;
63 default: x=2; break;
64 case 2: z=x; break;
65 }return true;}
66 /**
67 * Write a description of method anotherMethod here.
68 *
69 *
70 */
71 private void anotherMethod( )
72 {
73 int x=2, y=3;
74 if(x==3)
75 y++;
76 else
77 x++;
78 try{ x=3; } catch(Exception e){System.out.println("Hello\n");} finally{x=2;} x++;}
79 /**
80 * Write a description of method getNum here.
81 *
82 * @param a
83 * @param b
84 * @param c
85 * @return
86 */
87 public String somethingElse ( int a , int b, int c )
88 { String s="yes"; a=b+c; return s;}
89 /**
90 * Write a description of class internal here.
91 *
92 * @author (your name)
93 * @version (a version number or a date)
94 */
95 static private class internal{
96 internal() {
97 }
98 }
99 /**
100 * Write a description of method incX here.
101 *
102 * @return
103 */
104 private int
105 incX(){
106 x=3;
107 for(int i=0; i<20; i++){
108 x=i*2;
109 }return x;
110 }
111
112 }
Test #23: Set Indent Width
Requirement Traceability:
User Manual section 2.17
Purpose:
Setting the indent width allows the code to be formatted in unison.
Procedure:
(1.) Select the Tools Menu and click "FixStyle Preferences". (2.) In the Preferences window expand "Printer" from the list in the left hand window. (3.) In the subdirectory of Printer choose "Indentation". (4.) In the corresponding panel that appears on the right side of the window click "Use tabs to indent" check box. (5.) Click Ok. (6.) Right click on the test class image. (7.) Select FixStyle then click Format.
Test Data:
INPUT
9 import java.util.*;
10 import java.lang.*;
11 import java.lang.reflect.*;
12
13 public class Test
14 {
15 // instance variables - replace the example below with your own
16 private int x;
17 private String [] str;
18 private int example[]= { 1,
19 2
20 };
21 private boolean bool1, bool2, b;
22
23
24 /**
25 * Constructor for objects of class Test
26 */
27 public Test(){ x=0; } public Test(int z) { x=z; }
28 public Test(int firstVeryLongParameter, String secondVeryLongParameter, boolean thirdVeryLongParameter)
29 { x=
30 firstVeryLongParameter;
31 str[0] = secondVeryLongParameter; }
32
33 /**
34 * An example of a method - replace this comment with your own
35 *
36 * @param y a sample parameter for a method
37 * @return the sum of x and y
38 */
39 public int sampleMethod( int y)
40 {
41 while(y!=0) y--;
42 y=2;
43 while (y>0){ y= x-1; x--; } y=2;
44 do{ x++;}while(x<100);
45
46 return (x>3 || x <0) ? x : y;
47 }
48 private boolean someMethod (int y, int z) {
49 switch (z)
50 {
51 case 1: y=z; break;
52 default: x=2; break;
53 case 2: z=x; break;
54 }return true;}
55 private void anotherMethod( )
56 {
57 int x=2, y=3;
58 if(x==3)
59 y++;
60 else
61 x++;
62 try{ x=3; } catch(Exception e){System.out.println("Hello\n");} finally{x=2;} x++;}
63 public String somethingElse ( int a , int b, int c )
64 { String s="yes"; a=b+c; return s;}
65
66 static private class internal{
67 internal() {
68 }
69 }
70 private int
71 incX(){
72 x=3;
73 for(int i=0; i<20; i++){
74 x=i*2;
75 }return x;
76 }
77
78 }
EXPECTED OUTPUT
9 import java.util.*;
10 import java.lang.*;
11 import java.lang.reflect.*;
12
13 public class Test
14 {
15 // instance variables - replace the example below with your own
16 private int x;
17 private String [] str;
18 private int example[]= { 1,
19 2
20 };
21 private boolean bool1, bool2, b;
22
23
24 /**
25 * Constructor for objects of class Test
26 */
27 public Test(){ x=0; } public Test(int z) { x=z; }
28 public Test(int firstVeryLongParameter, String secondVeryLongParameter, boolean thirdVeryLongParameter)
29 { x=
30 firstVeryLongParameter;
31 str[0] = secondVeryLongParameter; }
32
33 /**
34 * An example of a method - replace this comment with your own
35 *
36 * @param y a sample parameter for a method
37 * @return the sum of x and y
38 */
39 public int sampleMethod( int y)
40 {
41 while(y!=0) y--;
42 y=2;
43 while (y>0){ y= x-1; x--; } y=2;
44 do{ x++;}while(x<100);
45
46 return (x>3 || x <0) ? x : y;
47 }
48 private boolean someMethod (int y, int z) {
49 switch (z)
50 {
51 case 1: y=z; break;
52 default: x=2; break;
53 case 2: z=x; break;
54 }return true;}
55 private void anotherMethod( )
56 {
57 int x=2, y=3;
58 if(x==3)
59 y++;
60 else
61 x++;
62 try{ x=3; } catch(Exception e){System.out.println("Hello\n");} finally{x=2;} x++;}
63 public String somethingElse ( int a , int b, int c )
64 { String s="yes"; a=b+c; return s;}
65
66 static private class internal{
67 internal() {
68 }
69 }
70 private int
71 incX(){
72 x=3;
73 for(int i=0; i<20; i++){
74 x=i*2;
75 }return x;
76 }
77
78 }
Attachments
- Test.java (2.0 kB) - added by jlray on 02/28/08 10:03:29.

