Now you can create fake objects that simulate UserDefaults. This works for several persistence mechanisms, not only UserDefaults. (But don’t use this technique for core data, where you can avoid persistence by using an in-memory store.)
Fake objects are one type of test double. What about mock objects? In the next chapter, we’ll move on to testing networking and how to write and use mock objects.