-
-
Notifications
You must be signed in to change notification settings - Fork 947
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58d4c59
commit 9d970d7
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# avoid print statements | ||
|
||
Try removing statements such as `System.out.println()` from your code. | ||
Exercise tests require the solution to _return_ values from methods instead of printing them. | ||
|
||
Usually, statements like these are added to help debug the code. | ||
However, a better approach is to debug the code while running one or more unit tests. | ||
This has the added advantage that one can focus on debugging a specific test case. | ||
|
||
Here are some links that explain how to debug Java code while running unit tests in various IDEs: | ||
|
||
- [Running and debugging Java tests in Visual Studio Code](https://code.visualstudio.com/docs/java/java-testing#_rundebug-test-cases) | ||
- [Debugging tests in IntelliJ IDEA](https://www.jetbrains.com/help/idea/performing-tests.html#RedebugFailedTests) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# do not use main method | ||
|
||
Try removing the `main` method from your code. | ||
Exercise tests don't require solutions to have a `main` method and having one makes the code slightly harder to read. | ||
|
||
Usually, a `main` method is added to help debug the code. | ||
However, a better approach is to debug the code while running one or more unit tests. | ||
This has the added advantage that one can focus on debugging a specific test case. | ||
|
||
Here are some links that explain how to debug Java code while running unit tests in various IDEs: | ||
|
||
- [Running and debugging Java tests in Visual Studio Code](https://code.visualstudio.com/docs/java/java-testing#_rundebug-test-cases) | ||
- [Debugging tests in IntelliJ IDEA](https://www.jetbrains.com/help/idea/performing-tests.html#RedebugFailedTests) |