You need to sign in to do that
Don't have an account?

Type is not visible: httpcalloutmock
Hi ,
I am trying to create a mock response for Http request , I receive the compile error as display below.
Type is not visible: httpcalloutmock
The class is :
@istest
global class MockHttpResponseGenerator implements HttpCalloutMock {
// Implement this interface method
global HTTPResponse respond(HTTPRequest req) {
// Optionally, only send a mock response for a specific endpoint
// and method.
System.assertEquals('http://test.bhtp.com/api/quotes', req.getEndpoint());
System.assertEquals('Post', req.getMethod());
// Create a fake response
HttpResponse res = new HttpResponse();
res.setHeader('Content-Type', 'application/json');
res.setBody(mockJSON);
res.setStatusCode(200);
return res;
}
}
Any help would be appreciated .
Thank you
I am trying to create a mock response for Http request , I receive the compile error as display below.
Type is not visible: httpcalloutmock
The class is :
@istest
global class MockHttpResponseGenerator implements HttpCalloutMock {
// Implement this interface method
global HTTPResponse respond(HTTPRequest req) {
// Optionally, only send a mock response for a specific endpoint
// and method.
System.assertEquals('http://test.bhtp.com/api/quotes', req.getEndpoint());
System.assertEquals('Post', req.getMethod());
// Create a fake response
HttpResponse res = new HttpResponse();
res.setHeader('Content-Type', 'application/json');
res.setBody(mockJSON);
res.setStatusCode(200);
return res;
}
}
Any help would be appreciated .
Thank you
global class MockHttpResponseGenerator implements HttpCalloutMock {
// Implement this interface method
global HTTPResponse respond(HTTPRequest req) {
// Optionally, only send a mock response for a specific endpoint
// and method.
string mockJSON =''{[foo, bar]}";
System.assertEquals('http://test.bhtp.com/api/quotes', req.getEndpoint());
System.assertEquals('Post', req.getMethod());
// Create a fake response
HttpResponse res = new HttpResponse();
res.setHeader('Content-Type', 'application/json');
res.setBody(mockJSON);
res.setStatusCode(200);
return res;
}
}
hi , I have initialized above the assert statements, but I don't think that is causing the problem ?