java-design-patterns/object-mother at java9 · DevLancer-Dz/java-design-patterns · GitHub
Skip to content

Latest commit

 

History

History
 
 

Folders and files

README.md

layout pattern
title Object Mother
folder object-mother
permalink /patterns/object-mother/
categories Creational
tags
Java
Difficulty-Beginner

Object Mother

Define a factory of immutable content with separated builder and factory interfaces.

alt text

Applicability

Use the Object Mother pattern when

  • You want consistent objects over several tests
  • you want to reduce code for creation of objects in tests
  • every test should run with fresh data

Credits