Testing facilitates change. If you are using unit testing, integration testing, and acceptance testing, then you are doing the right thing.
Unit tests run fast and are used to test the smallest unit of code such as a method or class. You could test a unit in a solitary environment by mocking all its other dependencies, which could be in the form of other classes that it may require. We could also test a unit along with its collaborating dependencies making it more real. Some components such as EJBs or Persistence code require a container-like environment to function, thus these are candidates for integration tests.
Microservice testing is challenging and brings with it new ways of testing code. Contract testing changes the perspective to be more consumer driven. It's possible to perform integration and acceptance testing using Arquillian and Cucumber.
In the next...