Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Testing value objects
Search
Fran Iglesias
November 02, 2018
Programming
0
260
Testing value objects
How to test things like immutability
Fran Iglesias
November 02, 2018
Tweet
Share
More Decks by Fran Iglesias
See All by Fran Iglesias
Tips for daily refactoring
franiglesias
0
340
Introduction to TDD: Red-Green-Refactor
franiglesias
1
280
testing the unpredictable
franiglesias
0
230
Tests doubles: the motion picture
franiglesias
0
510
Low cost techniques for test doubles
franiglesias
0
210
Other Decks in Programming
See All in Programming
組織で育むオブザーバビリティ
ryota_hnk
0
170
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
510
今こそ知るべき耐量子計算機暗号(PQC)入門 / PQC: What You Need to Know Now
mackey0225
3
370
Oxlintはいいぞ
yug1224
5
1.3k
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
990
Architectural Extensions
denyspoltorak
0
280
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
6k
開発者から情シスまで - 多様なユーザー層に届けるAPI提供戦略 / Postman API Night Okinawa 2026 Winter
tasshi
0
200
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
なるべく楽してバックエンドに型をつけたい!(楽とは言ってない)
hibiki_cube
0
140
余白を設計しフロントエンド開発を 加速させる
tsukuha
7
2.1k
KIKI_MBSD Cybersecurity Challenges 2025
ikema
0
1.3k
Featured
See All Featured
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
130
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Skip the Path - Find Your Career Trail
mkilby
0
53
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2k
Docker and Python
trallard
47
3.7k
Leo the Paperboy
mayatellez
4
1.4k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
180
A Soul's Torment
seathinner
5
2.2k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
110
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
57
50k
Transcript
TDD 101 2. TDDing Value Objects
TDDing Value Objects
Value Object (DDD) Small object Represents a concept Equality based
on value Immutable: • Should be created consistent • Mutators should return new instances
So… How do you TDD a VO?
TDD VO Think of an invalid example Write a test
that fails expecting exception Make the test pass Repeat as needed to test invalid cases
TDD VO Think of a valid example Write a test
that fails asserting value Make the test pass
TDD VO Equality Write a test that fails expecting inequality
Make the test pass Then write a test that fails expecting equality Make the test pass
TDD VO Immutability Think of a valid example of a
mutator Write a test that fails expecting a different instance Make the test pass
None