+ Start a Discussion
Shane K 8Shane K 8 

Method incorrect signature


I am getting this error when calling the CalloutClass from test method.

Method does not exist or incorrect signature: void getParams(Id) from the type CalloutClass
public class CalloutClass {
    @future (callout=true)
    public static void getParams(List<Id> Ids)
        catch (Exception e) {

public class CalloutClassTest {
    static testMethod void testMethod() {
        ObjX__c testX = new ObjX__c();
        testx.Name = 'test record' ;
        insert testX;
        Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator());
        // Call method to test.
        // This causes a fake response to be sent
        // from the class that implements HttpCalloutMock. 
        HttpResponse res = CalloutClass.getParams(testX.id);
        // Verify response received contains fake values
        String contentType = res.getHeader('Content-Type');
        System.assert(contentType == 'application/json');
        String actualValue = res.getBody();
        String expectedValue = '{"example":"test"}';
        System.assertEquals(actualValue, expectedValue);
        System.assertEquals(200, res.getStatusCode());
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://example.com/example/test', req.getEndpoint());
        System.assertEquals('GET', req.getMethod());
        // Create a fake response
        HttpResponse res = new HttpResponse();
        res.setHeader('Content-Type', 'application/json');
        return res;

ANUTEJANUTEJ (Salesforce Developers) 
Hi Shane,

Can you try checking if the error disappears if the id is sent as a list instead of a single id?

Looking forward to your response.

Shane K 8Shane K 8
Hi Anutej,

Tried passing a list but the error persists.