Skip to content

Commit 4378062

Browse files
committed
fix: correct test files
1 parent b2ad3ef commit 4378062

File tree

5 files changed

+7
-11
lines changed
  • error_templates/java/test_files

5 files changed

+7
-11
lines changed

error_templates/java/test_files/missing_return_error/test.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ Since the `addNumbers` method is declared to return an `int`, you need to provid
2222
```diff
2323
public class MissingReturn {
2424
public int addNumbers(int a, int b) {
25-
- // Missing return statement
26-
+ // Missing return statement
25+
// Missing return statement
2726
+ return b;
2827
}
2928

error_templates/java/test_files/parse_end_of_file_error/test.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ This error occurs when the compiler expects more code but encounters the end of
1717
```
1818
## Steps to fix
1919
### Complete the code
20-
Add the missing `}` in line 4
20+
Add the missing `}` in line 4.
2121
```diff
2222
public static void main(String[] args) {
2323
System.out.println("This is a sample program.");
24-
- }
25-
+ }
24+
}
2625
+ }
2726

2827
```

error_templates/java/test_files/public_class_filename_mismatch_error/test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class Right {
1717
```
1818
## Steps to fix
1919
### 1. Rename your file
20-
Rename the file to "Right.java" to match the class
20+
Rename the file to "Right.java" to match the class.
2121

2222
### 2. Rename the public class
2323
The filename should match the name of the public class in the file. To resolve this, change the class name to match the filename.

error_templates/java/test_files/symbol_not_found_error_missing_method/test.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ The error indicates that the compiler cannot find the method `displayArray(int[]
2121
```
2222
## Steps to fix
2323
### Define the missing method.
24-
Add the missing method `displayArray` to the `Test` class
24+
Add the missing method `displayArray` to the `Test` class.
2525
```diff
2626
int[] numbers = {1, 2, 3, 4, 5};
2727
displayArray(numbers);
28-
- }
29-
+ }
28+
}
3029
+
3130
+ private static void displayArray(int[] a) {
3231
+ // Add code here

error_templates/java/test_files/uninitialized_variable_error/test.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ Alternatively, you can assign a value to the variable before using it.
3434
```diff
3535
public class UninitializedVariable {
3636
public static void main(String[] args) {
37-
- int number;
38-
+ int number;
37+
int number;
3938
+ number = 0; // or any other valid value
4039

4140
// Variable 'number' might not have been initialized

0 commit comments

Comments
 (0)