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
220
Tests doubles: the motion picture
franiglesias
0
490
Low cost techniques for test doubles
franiglesias
0
200
Other Decks in Programming
See All in Programming
Claude Codeの「Compacting Conversation」を体感50%減! CLAUDE.md + 8 Skills で挑むコンテキスト管理術
kmurahama
1
680
Developing static sites with Ruby
okuramasafumi
0
340
新卒エンジニアのプルリクエスト with AI駆動
fukunaga2025
0
240
愛される翻訳の秘訣
kishikawakatsumi
3
360
チームをチームにするEM
hitode909
0
420
tparseでgo testの出力を見やすくする
utgwkk
2
330
The Art of Re-Architecture - Droidcon India 2025
siddroid
0
150
生成AI時代を勝ち抜くエンジニア組織マネジメント
coconala_engineer
0
35k
Denoのセキュリティに関する仕組みの紹介 (toranoana.deno #23)
uki00a
0
200
Grafana:建立系統全知視角的捷徑
blueswen
0
260
ゲームの物理 剛体編
fadis
0
390
Rubyで鍛える仕組み化プロヂュース力
muryoimpl
0
250
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
25
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
How Software Deployment tools have changed in the past 20 years
geshan
0
30k
The Language of Interfaces
destraynor
162
26k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
350
ラッコキーワード サービス紹介資料
rakko
0
1.9M
Git: the NoSQL Database
bkeepers
PRO
432
66k
We Have a Design System, Now What?
morganepeng
54
8k
Being A Developer After 40
akosma
91
590k
AI: The stuff that nobody shows you
jnunemaker
PRO
1
37
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
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