I observed the above error in one of my friends developer org.
Problem: When he is saving some apex class,he is facing that issue.
That piece of code looks like this
@isTest
public class AnimalLocatorTest {
@isTest static void testPostCallout() {
Test.setMock(HttpCalloutMock.class, new AnimalLocatorMock());
string s = AnimalLocator.getAnimalNameById(1);
}
}
Solution: At first I was surprised.I didn't find any thing wrong in the code.Finally I observed that he has created one apex class with the name "test" which is creating this problem.So delete the apex class with the name "Test",then your issue is resolved.
Enjoy Coding...
Problem: When he is saving some apex class,he is facing that issue.
That piece of code looks like this
@isTest
public class AnimalLocatorTest {
@isTest static void testPostCallout() {
Test.setMock(HttpCalloutMock.class, new AnimalLocatorMock());
string s = AnimalLocator.getAnimalNameById(1);
}
}
Solution: At first I was surprised.I didn't find any thing wrong in the code.Finally I observed that he has created one apex class with the name "test" which is creating this problem.So delete the apex class with the name "Test",then your issue is resolved.
Enjoy Coding...
I had faced same issue. I had used System.Test.SetMock instead of Test.SetMock to solve this issue.
ReplyDeleteoh Thanks.We can resolve in the way you said.
ReplyDeleteThank you Souvik, i tried your way, its working.
ReplyDeleteThank you, it solved my problem
ReplyDelete