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
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
1k
[KNOTS 2026登壇資料]AIで拡張‧交差する プロダクト開発のプロセス および携わるメンバーの役割
hisatake
0
270
Implementation Patterns
denyspoltorak
0
280
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
170
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
190
CSC307 Lecture 03
javiergs
PRO
1
490
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
4
270
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
140
高速開発のためのコード整理術
sutetotanuki
1
390
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
7.3k
Unicodeどうしてる? PHPから見たUnicode対応と他言語での対応についてのお伺い
youkidearitai
PRO
1
2.5k
Fragmented Architectures
denyspoltorak
0
150
Featured
See All Featured
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
240
Amusing Abliteration
ianozsvald
0
97
The Language of Interfaces
destraynor
162
26k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
100
Accessibility Awareness
sabderemane
0
51
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Six Lessons from altMBA
skipperchong
29
4.1k
Deep Space Network (abreviated)
tonyrice
0
47
Information Architects: The Missing Link in Design Systems
soysaucechin
0
770
Building Flexible Design Systems
yeseniaperezcruz
330
40k
My Coaching Mixtape
mlcsv
0
47
Designing for humans not robots
tammielis
254
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