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
200
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
210
testing the unpredictable
franiglesias
0
170
Tests doubles: the motion picture
franiglesias
0
420
Low cost techniques for test doubles
franiglesias
0
150
Other Decks in Programming
See All in Programming
Serverless Rust: Your Low-Risk Entry Point to Rust in Production (and the benefits are huge)
lmammino
1
170
1年目の私に伝えたい!テストコードを怖がらなくなるためのヒント/Tips for not being afraid of test code
push_gawa
1
670
JAWS Days 2025のインフラ
komakichi
1
370
PRレビューのお供にDanger
stoticdev
1
250
Visual StudioのGitHub Copilotでいろいろやってみる
tomokusaba
1
230
ABEMA iOS 大規模プロジェクトにおける段階的な技術刷新 / ABEMA iOS Technology Upgrade
akkyie
1
260
たのしいSocketのしくみ / Socket Under a Microscope
coe401_
8
1.5k
Webフレームワークとともに利用するWeb components / JSConf.jp おかわり
spring_raining
1
150
Rails 1.0 のコードで学ぶ find_by* と method_missing の仕組み / Learn how find_by_* and method_missing work in Rails 1.0 code
maimux2x
1
270
Duke on CRaC with Jakarta EE
ivargrimstad
0
330
PHPのバージョンアップ時にも役立ったAST
matsuo_atsushi
0
240
Amazon Bedrockマルチエージェントコラボレーションを諦めてLangGraphに入門してみた
akihisaikeda
1
180
Featured
See All Featured
KATA
mclloyd
29
14k
The Pragmatic Product Professional
lauravandoore
32
6.4k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
175
52k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.3k
Facilitating Awesome Meetings
lara
53
6.3k
Optimising Largest Contentful Paint
csswizardry
34
3.1k
Java REST API Framework Comparison - PWX 2021
mraible
29
8.4k
Building an army of robots
kneath
303
45k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.2k
Designing on Purpose - Digital PM Summit 2013
jponch
117
7.1k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
4 Signs Your Business is Dying
shpigford
183
22k
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