Why avoid mocks

You mean indirectly? Then the answer is yes. I have added the module Foo within the example which invokes String.trim() and the tests succeed