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
280
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
360
Introduction to TDD: Red-Green-Refactor
franiglesias
1
310
testing the unpredictable
franiglesias
0
250
Tests doubles: the motion picture
franiglesias
0
530
Low cost techniques for test doubles
franiglesias
0
230
Other Decks in Programming
See All in Programming
密結合なバックエンドから TypeScript のコードを生成する
kemuridama
1
390
Technical Debt: Understanding it Rightly, Engaging it Rightly #LaravelLiveJP
shogogg
0
170
ReactとSvelteのその先、Ripple-TS / Beyond React and Svelte: Ripple-TS
ssssota
3
1.7k
横断組織出身のQAEがインプロセスQAEでつまずいたこと・活かせたこと
ty89
0
450
Copilot CLI の継戦能力を高める コンテキスト管理
nozomutu
1
1.1k
Oxlintはいかにしてtsgolintのlint ruleを呼び出しているのか
syumai
2
1k
自動レビューエンジンの実装と運用 ~レビューのない世界へ~
kurukuru1999
2
290
Swiftのレキシカルスコープ管理
kntkymt
0
200
CLIであることを活かしたGitHub Copilot CLI活用術 / GitHub Copilot CLI Pro Tips & Tricks
nao_mk2
1
1.1k
Inside Stream API
skrb
1
290
SPMマルチモジュールで テストカバレッジを取得する技法
yosshi4486
0
130
誰も頼んでない機能を出荷した話
zekutax
0
150
Featured
See All Featured
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.5k
How to Think Like a Performance Engineer
csswizardry
28
2.6k
Being A Developer After 40
akosma
91
590k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Abbi's Birthday
coloredviolet
2
7.8k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.7k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
120k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
430
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
180
Faster Mobile Websites
deanohume
310
31k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
350
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