docs: update object mother

This commit is contained in:
Ilkka Seppälä
2024-05-26 21:18:48 +03:00
parent 42db186033
commit 6f46fbb208
+6 -10
View File
@@ -121,10 +121,6 @@ class RoyaltyObjectMotherTest {
In this way, the Object Mother pattern simplifies the creation of objects for testing, making the tests easier to read and maintain. In this way, the Object Mother pattern simplifies the creation of objects for testing, making the tests easier to read and maintain.
## Class diagram
![Object Mother](./etc/object-mother.png "Object Mother")
## Applicability ## Applicability
Use the Object Mother pattern when Use the Object Mother pattern when
@@ -135,9 +131,9 @@ Use the Object Mother pattern when
## Tutorials ## Tutorials
* [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) * [What is an ObjectMother? (Stack Overflow)](http://stackoverflow.com/questions/923319/what-is-an-objectmother)
* [c2wiki - Object Mother](http://c2.com/cgi/wiki?ObjectMother) * [Object Mother (c2wiki)](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) * [Test Data Builders: an alternative to the Object Mother pattern (Nat Pryce)](http://www.natpryce.com/articles/000714.html)
## Known Uses ## Known Uses
@@ -160,10 +156,10 @@ Trade-offs:
## Related Patterns ## Related Patterns
[Builder](https://java-design-patterns.com/patterns/builder/): Both patterns deal with object creation. The Object Mother is often simpler and used specifically in a testing context, whereas the Builder Pattern is more general-purpose. * [Builder](https://java-design-patterns.com/patterns/builder/): Both patterns deal with object creation. The Object Mother is often simpler and used specifically in a testing context, whereas the Builder Pattern is more general-purpose.
[Factory Method](https://java-design-patterns.com/patterns/factory-method/): Similar in the sense of centralizing object creation logic. The Object Mother is specifically aimed at tests, while Factory Method is used more broadly in application code. * [Factory Method](https://java-design-patterns.com/patterns/factory-method/): Similar in the sense of centralizing object creation logic. The Object Mother is specifically aimed at tests, while Factory Method is used more broadly in application code.
## Credits ## Credits
* [xUnit Test Patterns: Refactoring Test Code](https://amzn.to/4dHGDpm)
* [Growing Object-Oriented Software, Guided by Tests](https://amzn.to/4dGfIuk) * [Growing Object-Oriented Software, Guided by Tests](https://amzn.to/4dGfIuk)
* [xUnit Test Patterns: Refactoring Test Code](https://amzn.to/4dHGDpm)