added tests using mocks and stubs