Added unit tests for exceptions and api class.