...
Note |
---|
JavaDoc comments should be used when capturing a test's state and behavior in the test method name would make it too long. JUnit 5 |
...
When writing unit or component tests, mock all dependencies that may fail. This allows the tests to guarantee that the unit or component under test behaves as excepted when one of its dependencies fails.
Steve Lombardi (Deactivated) - Clarification: Are there are cases where it's acceptable to use a mock-less test? Can I setup a temp folder if it's easier?
Comment:
...
.
This is especially important in unit tests as these may be the only tests where some of those exception scenarios can be tested.
Note |
---|
Simply dependencies (e.g., POJOs) or dependencies that are difficult to mock out (e.g., file system, static utility classes) can be used directly without being mocked, as long as doing so doesn't go against the basic testing best practices. |
Clean Up After Yourself
Always make sure that tests clean up after themselves to ensure that a test failure doesn't impact other tests.
...