Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying MOCKITO COOKBOOK
  • Table Of Contents Toc
  • Feedback & Rating feedback
MOCKITO COOKBOOK

MOCKITO COOKBOOK

By : Grzejszczak
4.3 (4)
close
close
MOCKITO COOKBOOK

MOCKITO COOKBOOK

4.3 (4)
By: Grzejszczak

Overview of this book

This is a focused guide with lots of practical recipes with presentations of business issues and presentation of the whole test of the system. This book shows the use of Mockito's popular unit testing frameworks such as JUnit, PowerMock, TestNG, and so on. If you are a software developer with no testing experience (especially with Mockito) and you want to start using Mockito in the most efficient way then this book is for you. This book assumes that you have a good knowledge level and understanding of Java-based unit testing frameworks.
Table of Contents (12 chapters)
close
close
11
Index

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: This is a Maven plugin for generating AssertJ assertions

In most cases, all you need is assertj-core since it already has plenty of useful assertions.

Regardless of the fact that you are using JUnit or TestNG, you still have to add assertj...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech

Create a Note

Modal Close icon
You need to login to use this feature.
notes
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Delete Note

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY