Chapter 3Digging Deeper into JUnit Assertions

In the last chapter we worked through a meaty example of writing unit tests against an existing bit of code. You learned how to use assertions to express expected outcomes.

In this chapter you’ll learn many additional ways to phrase asserts in JUnit by using a library known as Hamcrest. You’ll also learn how to write tests when you’re expecting exceptions.

Get Pragmatic Unit Testing in Java 8 with JUnit now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.