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
210
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
320
Introduction to TDD: Red-Green-Refactor
franiglesias
1
230
testing the unpredictable
franiglesias
0
180
Tests doubles: the motion picture
franiglesias
0
440
Low cost techniques for test doubles
franiglesias
0
160
Other Decks in Programming
See All in Programming
Haskell でアルゴリズムを抽象化する / 関数型言語で競技プログラミング
naoya
16
3.9k
型付きアクターモデルがもたらす分散シミュレーションの未来
piyo7
0
750
Javaに鉄道指向プログラミング (Railway Oriented Pro gramming) のエッセンスを取り入れる/Bringing the Essence of Railway-Oriented Programming to Java
cocet33000
2
530
実はすごいスピードで進化しているCSS
hayato_yokoyama
0
110
TypeScript LSP の今までとこれから
quramy
1
490
CSC307 Lecture 17
javiergs
PRO
0
110
コードに語らせよう――自己ドキュメント化が内包する楽しさについて / Let the Code Speak
nrslib
6
1.4k
インターフェース設計のコツとツボ
togishima
2
690
Development of an App for Intuitive AI Learning - Blockly Summit 2025
teba_eleven
0
110
プロダクト開発でも使おう 関数のオーバーロード
yoiwamoto
0
140
FormFlow - Build Stunning Multistep Forms
yceruto
1
150
Cline指示通りに動かない? AI小説エージェントで学ぶ指示書の書き方と自動アップデートの仕組み
kamomeashizawa
1
410
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
35
2.3k
VelocityConf: Rendering Performance Case Studies
addyosmani
329
24k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
Producing Creativity
orderedlist
PRO
346
40k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.8k
Designing for Performance
lara
609
69k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Unsuck your backbone
ammeep
671
58k
Adopting Sorbet at Scale
ufuk
77
9.4k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
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