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
220
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
320
Introduction to TDD: Red-Green-Refactor
franiglesias
1
240
testing the unpredictable
franiglesias
0
180
Tests doubles: the motion picture
franiglesias
0
450
Low cost techniques for test doubles
franiglesias
0
170
Other Decks in Programming
See All in Programming
プロダクトという一杯を作る - プロダクトチームが味の責任を持つまでの煮込み奮闘記
hiliteeternal
0
240
Understanding Kotlin Multiplatform
l2hyunwoo
0
220
Yes, You Can Work on Rails & any other Gem
kaspth
0
120
ソフトウェア設計とAI技術の活用
masuda220
PRO
25
6.8k
Streamlitで実現できるようになったこと、実現してくれたこと
ayumu_yamaguchi
2
220
[Codecon - 2025] Como não odiar seus testes
camilacampos
0
100
GPUを計算資源として使おう!
primenumber
1
290
No Install CMS戦略 〜 5年先を見据えたフロントエンド開発を考える / no_install_cms
rdlabo
0
340
AI Agent 時代のソフトウェア開発を支える AWS Cloud Development Kit (CDK)
konokenj
6
990
Jakarta EE Meets AI
ivargrimstad
0
320
Android 16KBページサイズ対応をはじめからていねいに
mine2424
0
670
CIを整備してメンテナンスを生成AIに任せる
hazumirr
0
240
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Statistics for Hackers
jakevdp
799
220k
Making the Leap to Tech Lead
cromwellryan
134
9.4k
How to train your dragon (web standard)
notwaldorf
96
6.1k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
33
2.4k
We Have a Design System, Now What?
morganepeng
53
7.7k
It's Worth the Effort
3n
185
28k
Designing for humans not robots
tammielis
253
25k
Six Lessons from altMBA
skipperchong
28
3.9k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
50
5.5k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
130
19k
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