Add a simple king and queen classes which implement the behaviour of the royalty interface. Also wrote the object mother of royalty objects which is final so you can just call the static methods in it to create objects with a specific state to use them fast in tests. The tests are already created for testing the behaviour and the type of the objects which are created by the object mother. I also created the UML diagrams via object aid and updated the readme.
31 lines
953 B
Markdown
31 lines
953 B
Markdown
---
|
|
layout: pattern
|
|
title: Object Mother
|
|
folder: object-mother
|
|
permalink: /patterns/object-mother/
|
|
pumlid:
|
|
categories: Creational
|
|
tags:
|
|
- Java
|
|
- Difficulty-Beginner
|
|
---
|
|
|
|
## Object Mother
|
|
Define a factory of immutable content with separated builder and factory interfaces.
|
|
|
|

|
|
|
|
## 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
|
|
|
|
* [Answer by David Brown](http://stackoverflow.com/questions/923319/what-is-an-objectmother) to the stackoverflow question: [What is an ObjectMother?](http://stackoverflow.com/questions/923319/what-is-an-objectmother)
|
|
|
|
* [c2wiki - Object Mother](http://c2.com/cgi/wiki?ObjectMother)
|
|
|
|
* [Nat Pryce - Test Data Builders: an alternative to the Object Mother pattern](http://www.natpryce.com/articles/000714.html) |