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
260
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
280
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
AI時代の認知負荷との向き合い方
optfit
0
150
余白を設計しフロントエンド開発を 加速させる
tsukuha
7
2.1k
Patterns of Patterns
denyspoltorak
0
1.4k
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
190
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
450
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
200
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.8k
ぼくの開発環境2026
yuzneri
0
190
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
680
dchart: charts from deck markup
ajstarks
3
990
Implementation Patterns
denyspoltorak
0
280
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
2k
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
50
14k
Deep Space Network (abreviated)
tonyrice
0
47
How to train your dragon (web standard)
notwaldorf
97
6.5k
Balancing Empowerment & Direction
lara
5
880
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
150
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
200
sira's awesome portfolio website redesign presentation
elsirapls
0
150
Abbi's Birthday
coloredviolet
1
4.7k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
180
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
65
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
120
Build The Right Thing And Hit Your Dates
maggiecrowley
38
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