Sure, let's say you're writing a web app that at some point needs to look up users by id and password. You could implement this as a function:
(defn get-user [db id pw]
...query the db...)
But the problem as you've noticed is that it's hard to test this function, because you have to somehow either actually hit a database during a test, or you have to redef the function. Instead I say we should make formal contracts in our applications. So we'd implement a protocol:
(defprotocol IDb
(get-user [this id pw]))