Saturday, 28 October 2017

Some of the programming best practices

1. Unit Tests should not be dependent on ordering.
2. The database connection should be mocked or use an in-memory database such as H2 when using in unit test.
3. Do now use try/catches in Jnit and just throw Exception from the test. JUnit will handle this better.
4. Use Constant.equals(variable) rather than var.equals(const) to avoid NullPointerException.

No comments:

Post a Comment