In cases where you want to expose a method only for testing purposes, you can use Guava’s VisibleForTesting annotation.

There is an IntelliJ plugin which can do that for you.