Unit testing is without any doubt a good way to minimize maintenance costs and risk of failures in production.
However, it can get tricky especially when it comes to more complex systems. Probably you have heard some of the following sentences (…or even said them yourself):

  • The code as it is now works, I tested it over and over by entering multiple data sets
  • We cannot write tests for that but we tested it manually
  • After the latest change we deployed and got some error in production
  • We can check the log files to see that everything is working

While unit testing is no silver bullet, it is still of great value. Pragmatic Unit Testing in Java 8 with JUnit by Jeff Langr is a broad guide for both beginners and advanced developers.
The books start with some basic startup topics as well as some general test principles such as FIRST, Right-BICEP, and CORRECT. Thereafter, the author even illustrates how good unit testing can contribute to cleaner code and better design.
Throughout the book the author uses one concrete application as the system under test which makes the different examples less abstract. In conclusion, I find this book quite valuable for both getting started as well as reference for the daily work.