Refactored Code | Changed some test using Mock