Explain how you would write unit tests for a newly developed API endpoint to ensure high test coverage.