Fix mox to use mock objects in 'if' statement