November 2018
Intermediate to advanced
346 pages
8h 12m
English
So far, we have looked at monkey patching a private global variable or function for the purposes of testing inside our data package. But what happens if we want to test other packages? Wouldn't it be nice to decouple the business logic layer from the database too? That would certainly stop our business logic layer tests from breaking for unrelated events, such as optimizing our SQL queries.
Again, we are faced with a dilemma; we could start large-scale refactoring, but as we've mentioned before, it's a lot of work and a lot of risk, especially without tests to keep us out of trouble. Let's look at the most straightforward business logic package we have, the get package:
// Getter will attempt to load a person. ...Read now
Unlock full access