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
270
0
Share
Testing value objects
How to test things like immutability
Fran Iglesias
November 02, 2018
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
300
testing the unpredictable
franiglesias
0
240
Tests doubles: the motion picture
franiglesias
0
520
Low cost techniques for test doubles
franiglesias
0
220
Other Decks in Programming
See All in Programming
Coding at the Speed of Thought: The New Era of Symfony Docker
dunglas
0
4.9k
おれのAgentic Coding 2026/03
tsukasagr
1
140
Cache-moi si tu peux : patterns et pièges du cache en production - Devoxx France 2026 - Conférence
slecache
0
210
YJITとZJITにはイカなる違いがあるのか?
nakiym
0
220
書籍「ユーザーストーリーマッピング」が私のバイブル
asumikam
3
290
t *testing.T は どこからやってくるの?
otakakot
0
500
ルールルルルルRubyの中身の予備知識 ── RubyKaigiの前に予習しなイカ?
ydah
1
180
Liberating Ruby's Parser from Lexer Hacks
ydah
1
120
アーキテクチャモダナイゼーションとは何か
nwiizo
17
5.1k
SkillがSkillを生む:QA観点出しを自動化した
sontixyou
6
3.4k
AIエージェントで業務改善してみた
taku271
0
520
Claude Code × Gemini × Ebitengine ゲーム制作素人WebエンジニアがGoでゲームを作った話
webzawa
0
120
Featured
See All Featured
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.6k
How to Ace a Technical Interview
jacobian
281
24k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
320
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.7k
Designing Experiences People Love
moore
143
24k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.7k
Into the Great Unknown - MozCon
thekraken
40
2.3k
Claude Code のすすめ
schroneko
67
220k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Facilitating Awesome Meetings
lara
57
6.8k
The Spectacular Lies of Maps
axbom
PRO
1
700
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
270
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