Having automated unit tests as part of your project build is one important thing to ensure everything works as expected when doing changes on the code. Code is most probably the most changing thing during a project. So write JUnit tests, automate them and RUN when building code.
Test driven development
There is a programming technique which recommends to write tests before writing code. Watch the following video how this works.
Infinite testing: Running tests only during build is not convenient when doing refactoring step-by-step. Install the infinitest plugin to run JUnit tests automatically after saving.
Test coverage: Shows visually how much code is covered by tests. Goes down to method line depth