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
270
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
290
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
atmaCup #23でAIコーディングを活用した話
ml_bear
4
710
日本だけで解禁されているアプリ起動の方法
ryunakayama
0
360
CSC307 Lecture 13
javiergs
PRO
0
310
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
2k
24時間止められないシステムを守る-医療ITにおけるランサムウェア対策の実際
koukimiura
2
180
Geminiの機能を調べ尽くしてみた
naruyoshimi
0
190
Go1.26 go fixをプロダクトに適用して困ったこと
kurakura0916
0
310
JPUG勉強会 OSSデータベースの内部構造を理解しよう
oga5
2
220
AIプロダクト時代のQAエンジニアに求められること
imtnd
1
500
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
310
Claude Codeセッション現状確認 2026福岡 / fukuoka-aicoding-00-beacon
monochromegane
3
340
個人開発は儲からない - それでも開発開始1ヶ月で300万円売り上げた方法
taishiyade
0
120
Featured
See All Featured
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
130
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
The Limits of Empathy - UXLibs8
cassininazir
1
240
Ethics towards AI in product and experience design
skipperchong
2
210
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.3k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.7k
Visualization
eitanlees
150
17k
Marketing to machines
jonoalderson
1
5k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
470
KATA
mclloyd
PRO
35
15k
Typedesign – Prime Four
hannesfritz
42
3k
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