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
290
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
360
Introduction to TDD: Red-Green-Refactor
franiglesias
1
330
testing the unpredictable
franiglesias
0
260
Tests doubles: the motion picture
franiglesias
0
550
Low cost techniques for test doubles
franiglesias
0
240
Other Decks in Programming
See All in Programming
What's New in Android 2026
veronikapj
0
240
Laravelで学ぶ Webアプリケーションチューニング入門/web_application_tuning_101
hanhan1978
4
1.6k
Built Our Own Background Agent at LayerX #aidevex_findy
layerx
PRO
9
4.6k
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
510
テーブルをDELETEした
yuzneri
0
130
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
530
【やさしく解説 設計編・中級 #1】一つの車に、運転手は一人 ~ある倉庫システムの事例から~
panda728
PRO
0
200
jsmini JavaScript Engine を作ってみた話
yosuke_furukawa
PRO
0
290
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
210
Apache Hive: そしてCloud Native Lakehouseへ
okumin
1
200
Foundation Models frameworkで画像分析
ryodeveloper
1
430
『コードを書く以外の』エンジニアリング〜課金基盤移行プロジェクト推進のためのTips4選
yuriko1211
0
560
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.1k
We Are The Robots
honzajavorek
0
290
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
820
For a Future-Friendly Web
brad_frost
183
10k
Un-Boring Meetings
codingconduct
0
360
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
Code Reviewing Like a Champion
maltzj
528
40k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
980
Practical Orchestrator
shlominoach
191
12k
Done Done
chrislema
186
16k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
270
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
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