Simplify usage of stubs in middleware unit tests