Fix NRE using Mocks in tests