O'Reilly logo

Mockito Cookbook by Marcin Grzejszczak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using AssertJ for assertions

In this recipe, we will add AssertJ to your classpath (or check if it's already there) and take a look at a test that should show the concept that lies behind the AssertJ library.

Getting ready

First, let's check the differences between the different AssertJ JAR files:

  • assertj-core: This file contains the vast majority of assertions (there is rarely a need to have any additional dependencies)
  • assertj-guava: This file contains additional assertions for some of the Guava library related classes
  • assertj-neo4j: This file contains additional assertions for the Neo4j graph database related classes
  • assertj-joda-time: This file contains additional assertions for the JodaTime library related classes
  • assertj-assertions-generator-maven-plugin ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required