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
180
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
310
Introduction to TDD: Red-Green-Refactor
franiglesias
1
200
testing the unpredictable
franiglesias
0
160
Tests doubles: the motion picture
franiglesias
0
390
Low cost techniques for test doubles
franiglesias
0
140
Other Decks in Programming
See All in Programming
Vue.js学習の振り返り
hiro_xre
2
130
生成 AI を活用した toitta 切片分類機能の裏側 / Inside toitta's AI-Based Factoid Clustering
pokutuna
0
660
開発効率向上のためのリファクタリングの一歩目の選択肢 ~コード分割~ / JJUG CCC 2024 Fall
ryounasso
0
380
外部システム連携先が10を超えるシステムでのアーキテクチャ設計・実装事例
kiwasaki
1
240
破壊せよ!データ破壊駆動で考えるドメインモデリング / data-destroy-driven
minodriven
16
4.2k
2万ページのSSG運用における工夫と注意点 / Vue Fes Japan 2024
chinen
3
1.4k
Googleのテストサイズを活用したテスト環境の構築
toms74209200
0
280
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
470
Content Security Policy入門 セキュリティ設定と 違反レポートのはじめ方 / Introduction to Content Security Policy Getting Started with Security Configuration and Violation Reporting
uskey512
1
440
Honoの来た道とこれから
yusukebe
19
3.1k
カラム追加で増えるActiveRecordのメモリサイズ イメージできますか?
asayamakk
4
1.7k
Golang と Erlang
taiyow
8
1.9k
Featured
See All Featured
Teambox: Starting and Learning
jrom
132
8.7k
Git: the NoSQL Database
bkeepers
PRO
426
64k
RailsConf 2023
tenderlove
29
880
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
27
1.9k
YesSQL, Process and Tooling at Scale
rocio
167
14k
Speed Design
sergeychernyshev
24
580
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Measuring & Analyzing Core Web Vitals
bluesmoon
2
46
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
108
49k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
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