Fixed issues with mocks
Added some tests