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
270
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
290
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
Oxlint JS plugins
kazupon
1
1.1k
AIによる高速開発をどう制御するか? ガードレール設置で開発速度と品質を両立させたチームの事例
tonkotsuboy_com
7
2.6k
The Ralph Wiggum Loop: First Principles of Autonomous Development
sembayui
0
3.7k
Beyond the Basics: Signal Forms
manfredsteyer
PRO
0
100
CSC307 Lecture 10
javiergs
PRO
1
690
並行開発のためのコードレビュー
miyukiw
2
2.1k
AI活用のコスパを最大化する方法
ochtum
0
110
受け入れテスト駆動開発(ATDD)×AI駆動開発 AI時代のATDDの取り組み方を考える
kztakasaki
2
490
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
310
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
300
JPUG勉強会 OSSデータベースの内部構造を理解しよう
oga5
2
220
エージェント開発初心者の僕がエージェントを作った話と今後やりたいこと
thasu0123
0
210
Featured
See All Featured
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
230
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.8k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
140
The Mindset for Success: Future Career Progression
greggifford
PRO
0
260
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
130
Designing Powerful Visuals for Engaging Learning
tmiket
0
250
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
1.9k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
840
Designing for humans not robots
tammielis
254
26k
The Language of Interfaces
destraynor
162
26k
Ruling the World: When Life Gets Gamed
codingconduct
0
160
Faster Mobile Websites
deanohume
310
31k
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