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
220
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
エンジニア向け採用ピッチ資料
inusan
0
160
『自分のデータだけ見せたい!』を叶える──Laravel × Casbin で複雑権限をスッキリ解きほぐす 25 分
akitotsukahara
1
540
Result型で“失敗”を型にするPHPコードの書き方
kajitack
4
380
生成AIコーディングとの向き合い方、AIと共創するという考え方 / How to deal with generative AI coding and the concept of co-creating with AI
seike460
PRO
1
330
明示と暗黙 ー PHPとGoの インターフェイスの違いを知る
shimabox
2
320
20250628_非エンジニアがバイブコーディングしてみた
ponponmikankan
0
420
GitHub Copilot and GitHub Codespaces Hands-on
ymd65536
1
120
設計やレビューに悩んでいるPHPerに贈る、クリーンなオブジェクト設計の指針たち
panda_program
6
1.4k
技術同人誌をMCP Serverにしてみた
74th
1
350
Java on Azure で LangGraph!
kohei3110
0
170
型付きアクターモデルがもたらす分散シミュレーションの未来
piyo7
0
810
ReadMoreTextView
fornewid
1
480
Featured
See All Featured
Designing Experiences People Love
moore
142
24k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
138
34k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Testing 201, or: Great Expectations
jmmastey
42
7.5k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
17
940
Large-scale JavaScript Application Architecture
addyosmani
512
110k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
8
670
Making the Leap to Tech Lead
cromwellryan
134
9.3k
The Cult of Friendly URLs
andyhume
79
6.5k
A Tale of Four Properties
chriscoyier
160
23k
Statistics for Hackers
jakevdp
799
220k
BBQ
matthewcrist
89
9.7k
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