Refactoring and Test Fakes: Crafting Resilient Code with Confidence
Crafting resilient code is one of the most important things we do as software developers, but it’s much easier said than done! Building with confidence requires an appropriate test harness and automated safeguards to ensure your software is robust.
: Pump { public val pumped = mutableListOf<Pair<Boolean, Boolean>>() override fun pump(full: Boolean): Boolean = onPump(full).also { pumped += full to it } } ashdavies.dev
Heater by delegate { private val _drinks = mutableListOf<Any>() val drinks: List<Any> by ::_drinks override fun <T : Any> heat(body: () -> T): T { return delegate.heat(body).also { _drinks += it } } } ashdavies.dev
Ma!in Fowler: Practical Test Pyramid ma!infowler.com/a!icles/practical-test-pyramid.html • Images: Monkey User monkeyuser.com • Michael Feathers: Working E"ectively with Legacy Code ISBN: 978-0-13117-705-5 • Sam Edwards: Wrapping Mockito Mocks for Reusability handstandsam.com/2020/06/08/wrapping-mockito-mocks-for-reusability • Steve Freeman, Nat Pryce: Growing Object-Oriented So#ware, Guided by Tests ISBN: 978-0-32150-362-6 • Testing on the Toilet: Don't mock Types You Don't Own testing.googleblog.com/2020/07/testing-on-toilet-dont-mock-types-you.html • Testing on the Toilet: Know Your Test Doubles testing.googleblog.com/2013/07/testing-on-toilet-know-your-test-doubles.html • Marcello Galhardo: No Mocks Allowed marcellogalhardo.dev/posts/no-mocks-allowed ashdavies.dev