Added unit tests to cover both the success and exception scenarios.