Mock a function to test return values and side effects
Preconditions (2)
Step 1: Create a mock for the external service function
Step 2: Set the mock to return a specific value when called
Step 3: Call the main function that uses the external service
Step 4: Verify the main function returns the mocked value
Step 5: Set the mock to raise an exception as a side effect
Step 6: Call the main function again and verify it handles the exception
✅ Expected Result: The test passes verifying the function returns the mocked value and correctly handles the side effect exception