Do test if the expected output of a method matches the actual one.
Do test whether the function calls made inside the method are occurring the desired number of times.
Do not try to test code that is not a part of the method under test.
Do not make API calls, database connections, or network requests while writing your tests.
Do test if the expected output of a method matches the actual one. Do test whether the function calls made inside the method are occurring the desired number of times. Do not try to test code that is not a part of the method under test. Do not make API calls, database connections, or network requests while writing your tests.
reference https://www.freecodecamp.org/news/java-unit-testing/