I have a Class using MetadataService and different methods of it. I want to create a test class for the same but it is giving an error that my test class have HTTP callouts. I am using the HttpCalloutMock but still it is giving me the same error. The Class is using MetadataService, and it is calling multiple callouts which may be the problem
@isTest
private class CustomLabelHelperTest {
static testMethod void createServiceTestMethod()
{
Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator());
Test.startTest();
MetadataService.MetadataPort service = CustomLabelHelper.createService();
Test.stopTest();
}
static testMethod void readCustomLabelsTestMethod()
{
Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator());
Test.startTest();
Map<String, CustomLabelHelper.CustomLabelData> customLabelDataMap = CustomLabelHelper.readCustomLabels();
Test.stopTest();
}
}
Here my first method is getting passed but the second method is failing.