Tim Cooke

Review: Pragmatic Unit Testing in Java 8 with JUnit

Cover art for Pragmatic Unit Testing

The Book

AuthorJeff Langr, with Andy Hunt and Dave Thomas

Published17th March 2015

PublisherThe Pragmatic Bookshelf

Book Websitepragprog.com/book/utj2

Author Websitelangrsoft.com

The Pragmatic Programmers classic is back! Freshly updated for modern software development, Pragmatic Unit Testing in Java 8 With JUnit teaches you how to write and run easily maintained unit tests in JUnit with confidence. You'll learn mnemonics to help you know what tests to write, how to remember all the boundary conditions, and what the qualities of a good test are. You'll see how unit tests can pay off by allowing you to keep your system code clean, and you'll learn how to handle the stuff that seems too tough to test.

The Review

Date1st June 2015

Rating8/10

In 'Pragmatic Unit Testing in Java 8' Jeff demonstrates a very effective way to develop software, that just happens to involve writing a lot of Unit Tests. While the book is aimed as Java programmers who are new to Unit Testing, more experienced programmers are likely to learn a thing or two as well.

The book starts by guiding you through the development of a sample application discussing how and, quite importantly, how you might write useful Unit Tests to verify that the application works as intended. The 'why' topic is nicely supplemented with a sequence of hypothetical conversations between two colleagues, where one is not sold on the virtues of testing and the other puts forth a reasoned argument. Having a single example application to work with is a nice coherent way for the readers to practice the material being presented for themselves.

The author gives a selective exploration into the features of the jUnit testing framework that he finds most useful and highlights how to use them to write expressive test code. The later chapters reinforce an important concept that your test code is just as important as your production code, and equal care should be taken in keeping it clean. A valuable mindset.

Overall, Pragmatic Unit Testing in Java 8 is a solid introduction to unit testing and presents a wealth of tips, tricks, and good practices that will set any programmer in good stead. Recommended.


Disclosure: I received a copy of this book from the publisher in exchange for writing this review on behalf of CodeRanch.