Skip to Main Content
MOCKITO COOKBOOK
book

MOCKITO COOKBOOK

by Marcin Grzejszczak
June 2014
Intermediate to advanced content levelIntermediate to advanced
284 pages
6h 9m
English
Packt Publishing
Content preview from MOCKITO COOKBOOK

Creating custom AssertJ assertions

In this recipe, we will create a custom AssertJ assertion. Please refer to the previous recipe for the presented assertions in the test because in the current recipe, we will combine them into our custom assertions:

Getting ready

For this recipe, our system under test will be a NewPersonGenerator class that will call an external service, NewIdentityCreator, to generate a new identity for the current person, as shown in the following code:

public class NewPersonGenerator { private final NewIdentityCreator newIdentityCreator; public NewPersonGenerator(NewIdentityCreator newIdentityCreator) { this.newIdentityCreator = newIdentityCreator; } public Person generateNewIdentity(Person person) { String newName = newIdentityCreator.createNewName(person); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mockito Essentials

Mockito Essentials

Sujoy Acharya
Mockito for Spring

Mockito for Spring

Sujoy Acharya
SPRING COOKBOOK

SPRING COOKBOOK

Jerome Jaglale, Murat Yilmaz

Publisher Resources

ISBN: 9781783982745Supplemental Content