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
240
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
330
Introduction to TDD: Red-Green-Refactor
franiglesias
1
260
testing the unpredictable
franiglesias
0
200
Tests doubles: the motion picture
franiglesias
0
470
Low cost techniques for test doubles
franiglesias
0
190
Other Decks in Programming
See All in Programming
Pythonに漸進的に型をつける
nealle
1
140
バッチ処理を「状態の記録」から「事実の記録」へ
panda728
PRO
0
210
data-viz-talk-cz-2025
lcolladotor
0
100
3年ぶりにコードを書いた元CTOが Claude Codeと30分でMVPを作った話
maikokojima
0
710
Register is more than clipboard
satorunooshie
1
170
Go言語はstack overflowの夢を見るか?
logica0419
0
660
Node-REDのノードの開発・活用事例とコミュニティとの関わり(Node-RED Con Nagoya 2025)
404background
0
110
CSC509 Lecture 08
javiergs
PRO
0
270
TFLintカスタムプラグインで始める Terraformコード品質管理
bells17
2
500
Module Proxyのマニアックな話 / Niche Topics in Module Proxy
kuro_kurorrr
0
200
TransformerからMCPまで(現代AIを理解するための羅針盤)
mickey_kubo
7
5.8k
スマホから Youtube Shortsを見られないようにする
lemolatoon
27
34k
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1032
470k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Done Done
chrislema
186
16k
How GitHub (no longer) Works
holman
315
140k
Fireside Chat
paigeccino
41
3.7k
Context Engineering - Making Every Token Count
addyosmani
8
320
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.6k
Visualization
eitanlees
150
16k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.5k
RailsConf 2023
tenderlove
30
1.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