function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Fnu SumitFnu Sumit 

Challenge Not yet complete... here's what's wrong: No Apex test class named 'AnimalLocatorTest' was found.

i have used akansha code and mousin suggestion to remove space but still challange is not complete:
Callout Class
global class AnimalLocator
{
    public class Animal {
    public Integer id;
    public String name;
    public String eats;
    public String says;

    }
    
    public class AnimalResult {
    public Animal animal;
    }

    public Static String getAnimalNameById(integer id)
    {
        List<Object> animal;
        String returnValue ;
        AnimalResult result;
        Http http=new Http();
        HttpRequest request =new HttpRequest();
        request.setEndPoint('https://th-apex-http-callout.herokuapp.com/animals/'+id);
        request.setMethod('GET');
        request.setHeader('Content-Type', 'application/json;charset=UTF-8');
        //request.setBody('{"id":"'+id+'"}');
        HttpResponse response= http.send(request);
        if(response.getStatusCode()==200)
        {
       result = (AnimalResult) JSON.deserialize(response.getBody(), AnimalResult.class);
       }
        return result.animal.name;

    }
    
}

MOCKResponse Class
@isTest
global class AnimalLocatorMock implements HttpCallOutMock
{
    public static HTTPResponse respond(HttpRequest req) 
    {
            HTTPResponse response =new HTTPResponse();
            response.setHeader('Content-Type', 'application/json');
            response.setBody('{"animal":{"id":1,"name":"chicken","eats":"chicken food","says":"cluck cluck"}}');
            response.setStatusCode(200);

             return response;

    }

}

Test Class

@isTest
public class AnimalLocatorTest 
{
    public static testMethod void mytestMethod()
    {
        Test.SetMock(HttpCallOutMock.class,new AnimalLocatorMock());
        
         String res= AnimalLocator.getAnimalNameById(1);
       
        
        String expectedValue = 'chicken';
        System.assertEquals(res, expectedValue);
        


    }

James LoghryJames Loghry
Hi Fru, are you sure you saved your test class correctly, without any error?  I ask, because you're missing a curly brace at the end, but you may have just not copied and pasted correctly.

Also, check that you're logged into the correct developer org.

I tried your unit test class and it verified / worked fine for me, so I suspect it's one of those errors above.

Regards,
- James
Fnu SumitFnu Sumit
i have checked everything. everything is fine and even it test 100% code.
it might be problem with my own domain. because i register my domain?????