using memoization and stubbing. complete testing