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
250
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
330
Introduction to TDD: Red-Green-Refactor
franiglesias
1
270
testing the unpredictable
franiglesias
0
210
Tests doubles: the motion picture
franiglesias
0
480
Low cost techniques for test doubles
franiglesias
0
190
Other Decks in Programming
See All in Programming
Atomics APIを知る / Understanding Atomics API
ssssota
1
210
DartASTとその活用
sotaatos
2
150
オフライン対応!Flutterアプリに全文検索エンジンを実装する @FlutterKaigi2025
itsmedreamwalker
2
300
ソフトウェア設計の課題・原則・実践技法
masuda220
PRO
22
18k
アーキテクチャと考える迷子にならない開発者テスト
irof
9
3.3k
CloudflareのSandbox SDKを試してみた
syumai
0
180
[堅牢.py #1] テストを書かない研究者に送る、最初にテストを書く実験コード入門 / Let's start your ML project by writing tests
shunk031
11
6k
Chart.jsで長い項目を表示するときのハマりどころ
yumechi
0
160
Agentに至る道 〜なぜLLMは自動でコードを書けるようになったのか〜
mackee
5
2k
Developing Specifications - Jakarta EE: a Real World Example
ivargrimstad
0
220
OSS開発者の憂鬱
yusukebe
13
11k
Web エンジニアが JavaScript で AI Agent を作る / JSConf JP 2025 sponsor session
izumin5210
4
2k
Featured
See All Featured
Embracing the Ebb and Flow
colly
88
4.9k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Why You Should Never Use an ORM
jnunemaker
PRO
60
9.6k
Java REST API Framework Comparison - PWX 2021
mraible
34
9k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.7k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
350
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
RailsConf 2023
tenderlove
30
1.3k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
A Modern Web Designer's Workflow
chriscoyier
697
190k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
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