refactor and add mock tests
reach 100% code coverage with mock tests