1

I'm using the APEX wrapper for Metadata API found here https://github.com/financialforcedev/apex-mdapi

Looking at the test coverage, there are a lot of lines uncovered. Can this be improved easily?

1

I posted an issue report on github here https://github.com/financialforcedev/apex-mdapi/issues/119

I've created the missing invocations to get the coverage close to 100%

Add this code (also in the github-issue) into your MetadataServiceTest.cls and you will be fine:

@IsTest
private static void elfMissingGetRecordsTest() { // elf patch
    new MetadataService.ReadFlowResult().getRecords();
    new MetadataService.ReadWorkflowResult().getRecords();
    new MetadataService.ReadWorkflowRuleResult().getRecords();
    new MetadataService.ReadAssignmentRulesResult().getRecords();
    new MetadataService.ReadAssignmentRuleResult().getRecords();
    new MetadataService.ReadAutoResponseRulesResult().getRecords();
    new MetadataService.ReadAutoResponseRuleResult().getRecords();
    new MetadataService.ReadEscalationRulesResult().getRecords();
    new MetadataService.ReadEscalationRuleResult().getRecords();
    new MetadataService.ReadPostTemplateResult().getRecords();
    new MetadataService.ReadApprovalProcessResult().getRecords();
    new MetadataService.ReadHomePageComponentResult().getRecords();
    new MetadataService.ReadHomePageLayoutResult().getRecords();
    new MetadataService.ReadCustomObjectTranslationResult().getRecords();
    new MetadataService.ReadTranslationsResult().getRecords();
    new MetadataService.ReadProfileResult().getRecords();
    new MetadataService.ReadPermissionSetResult().getRecords();
    new MetadataService.ReadDataCategoryGroupResult().getRecords();
    new MetadataService.ReadRemoteSiteSettingResult().getRecords();
    new MetadataService.ReadPackageResult().getRecords();
    new MetadataService.ReadAuthProviderResult().getRecords();
    new MetadataService.ReadKnowledgeSettingsResult().getRecords();
    new MetadataService.ReadSharingSetResult().getRecords();
    new MetadataService.ReadSecuritySettingsResult().getRecords();
    new MetadataService.ReadIdeasSettingsResult().getRecords();
    new MetadataService.ReadChatterAnswersSettingsResult().getRecords();
    new MetadataService.ReadCommunityResult().getRecords();
    new MetadataService.ReadActivitiesSettingsResult().getRecords();
    new MetadataService.ReadContractSettingsResult().getRecords();
    new MetadataService.ReadOrderSettingsResult().getRecords();
    new MetadataService.ReadOpportunitySettingsResult().getRecords();
    new MetadataService.ReadProductSettingsResult().getRecords();
    new MetadataService.ReadQuoteSettingsResult().getRecords();
    new MetadataService.ReadCallCenterResult().getRecords();
    new MetadataService.ReadEntitlementProcessResult().getRecords();
    new MetadataService.ReadMilestoneTypeResult().getRecords();
    new MetadataService.ReadEntitlementTemplateResult().getRecords();
    new MetadataService.ReadEntitlementSettingsResult().getRecords();
    new MetadataService.ReadBusinessHoursSettingsResult().getRecords();
    new MetadataService.ReadBusinessHoursEntryResult().getRecords();
    new MetadataService.ReadConnectedAppResult().getRecords();
    new MetadataService.ReadAppMenuResult().getRecords();
    new MetadataService.ReadMobileSettingsResult().getRecords();
    new MetadataService.ReadNetworkResult().getRecords();
    new MetadataService.ReadCompanySettingsResult().getRecords();
    new MetadataService.ReadForecastingSettingsResult().getRecords();
    new MetadataService.ReadSamlSsoConfigResult().getRecords();
    new MetadataService.ReadLiveAgentSettingsResult().getRecords();
    new MetadataService.ReadSkillResult().getRecords();
    new MetadataService.ReadLiveChatDeploymentResult().getRecords();
    new MetadataService.ReadLiveChatButtonResult().getRecords();
    new MetadataService.ReadLiveChatAgentConfigResult().getRecords();
    new MetadataService.ReadSynonymDictionaryResult().getRecords();
    new MetadataService.ReadFolderResult().getRecords();
    new MetadataService.ReadReportFolderResult().getRecords();
    new MetadataService.ReadDashboardFolderResult().getRecords();
    new MetadataService.ReadDocumentFolderResult().getRecords();
    new MetadataService.ReadEmailFolderResult().getRecords();
    new MetadataService.ReadRoleOrTerritoryResult().getRecords();
    new MetadataService.ReadWorkflowActionResult().getRecords();
    new MetadataService.ReadSiteDotComResult().getRecords();
    new MetadataService.ReadWorkflowTaskResult().getRecords();
    new MetadataService.ReadWorkflowSendResult().getRecords();
    new MetadataService.ReadWorkflowOutboundMessageResult().getRecords();
    new MetadataService.ReadWorkflowKnowledgePublishResult().getRecords();
    new MetadataService.ReadWorkflowFieldUpdateResult().getRecords();
    new MetadataService.ReadWorkflowAlertResult().getRecords();
    new MetadataService.ReadVisualizationPluginResult().getRecords();
    new MetadataService.ReadCustomMetadataResult().getRecords();
    new MetadataService.ReadNameSettingsResult().getRecords();
    new MetadataService.ReadMarketingActionSettingsResult().getRecords();
    new MetadataService.ReadCustomPermissionResult().getRecords();
    new MetadataService.ReadAuraDefinitionBundleResult().getRecords();
    new MetadataService.ReadCorsWhitelistOriginResult().getRecords();
    new MetadataService.ReadManagedTopicsResult().getRecords();
    new MetadataService.ReadTerritory2Result().getRecords();
    new MetadataService.ReadTerritory2ModelResult().getRecords();
    new MetadataService.ReadTerritory2SettingsResult().getRecords();
    new MetadataService.ReadTerritory2TypeResult().getRecords();
    new MetadataService.ReadXOrgHubResult().getRecords();
    new MetadataService.ReadActionLinkGroupTemplateResult().getRecords();
    new MetadataService.ReadLicenseDefinitionResult().getRecords();
    new MetadataService.ReadMarketingResourceTypeResult().getRecords();
    new MetadataService.ReadMatchingRuleResult().getRecords();
    new MetadataService.ReadMatchingRulesResult().getRecords();
    new MetadataService.ReadNamedCredentialResult().getRecords();
    new MetadataService.ReadPersonalJourneySettingsResult().getRecords();
    new MetadataService.ReadSharingRulesResult().getRecords();
    new MetadataService.ReadSharingBaseRuleResult().getRecords();
    new MetadataService.ReadSharingCriteriaRuleResult().getRecords();
    new MetadataService.ReadSharingOwnerRuleResult().getRecords();
    new MetadataService.ReadSharingTerritoryRuleResult().getRecords();
    new MetadataService.ReadMetadataWithContentResult().getRecords();

    new MetadataService.ReadCustomSiteResult().getRecords();
    new MetadataService.ReadListViewResult().getRecords();
    new MetadataService.ReadInstalledPackageResult().getRecords();
    new MetadataService.ReadCustomFieldResult().getRecords();
    new MetadataService.ReadFieldSetResult().getRecords();
    new MetadataService.ReadPicklistValueResult().getRecords();
    new MetadataService.ReadRecordTypeResult().getRecords();
    new MetadataService.ReadWebLinkResult().getRecords();
    new MetadataService.ReadAddressSettingsResult().getRecords();
    new MetadataService.ReadCaseSettingsResult().getRecords();
    new MetadataService.ReadCustomObjectResult().getRecords();
    new MetadataService.ReadLayoutResult().getRecords();
    new MetadataService.ReadEmailTemplateResult().getRecords();
    new MetadataService.ReadScontrolResult().getRecords();
    new MetadataService.ReadApexPageResult().getRecords();
    new MetadataService.ReadApexComponentResult().getRecords();
    new MetadataService.ReadApexClassResult().getRecords();
    new MetadataService.ReadApexTriggerResult().getRecords();
    new MetadataService.ReadStaticResourceResult().getRecords();
    new MetadataService.ReadDocumentResult().getRecords();
    new MetadataService.ReadCustomLabelsResult().getRecords();
    new MetadataService.ReadCustomLabelResult().getRecords();
    new MetadataService.ReadAccountSettingsResult().getRecords();
    new MetadataService.ReadQueueResult().getRecords();
    new MetadataService.ReadCustomDataTypeResult().getRecords();
    new MetadataService.ReadExternalDataSourceResult().getRecords();
    new MetadataService.ReadGroupResult().getRecords();
    new MetadataService.ReadBusinessProcessResult().getRecords();
    new MetadataService.ReadCompactLayoutResult().getRecords();
    new MetadataService.ReadSharingReasonResult().getRecords();
    new MetadataService.ReadValidationRuleResult().getRecords();
    new MetadataService.ReadReportTypeResult().getRecords();
    new MetadataService.ReadReportResult().getRecords();
    new MetadataService.ReadDashboardResult().getRecords();
    new MetadataService.ReadAnalyticSnapshotResult().getRecords();
    new MetadataService.ReadCustomPageWebLinkResult().getRecords();
    new MetadataService.ReadQuickActionResult().getRecords();
    new MetadataService.ReadFlexiPageResult().getRecords();
    new MetadataService.ReadCustomTabResult().getRecords();
    new MetadataService.ReadCustomApplicationComponentResult().getRecords();
    new MetadataService.ReadCustomApplicationResult().getRecords();
    new MetadataService.ReadPortalResult().getRecords();
    new MetadataService.ReadLetterheadResult().getRecords();

    new MetadataService.ReadFlowResult().getRecords();
    new MetadataService.ReadFlowResult().getRecords();



}

@IsTest
private static void elfMissingGetResultTest() { // elf patch
    new MetadataService.checkStatus_element();
    new MetadataService.checkStatusResponse_element();

    new MetadataService.readWorkflowRuleResponse_element().getResult();
    new MetadataService.readSamlSsoConfigResponse_element().getResult();
    new MetadataService.readCustomLabelResponse_element().getResult();
    new MetadataService.readBusinessHoursEntryResponse_element().getResult();
    new MetadataService.readMobileSettingsResponse_element().getResult();
    new MetadataService.readChatterAnswersSettingsResponse_element().getResult();
    new MetadataService.readSharingRulesResponse_element().getResult();
    new MetadataService.readPortalResponse_element().getResult();
    new MetadataService.readSkillResponse_element().getResult();
    new MetadataService.readEscalationRulesResponse_element().getResult();
    new MetadataService.readCustomDataTypeResponse_element().getResult();
    new MetadataService.readExternalDataSourceResponse_element().getResult();
    new MetadataService.readEntitlementProcessResponse_element().getResult();
    new MetadataService.readRecordTypeResponse_element().getResult();
    new MetadataService.readScontrolResponse_element().getResult();
    new MetadataService.readDataCategoryGroupResponse_element().getResult();
    new MetadataService.readValidationRuleResponse_element().getResult();
    new MetadataService.readProfileResponse_element().getResult();
    new MetadataService.readIdeasSettingsResponse_element().getResult();
    new MetadataService.readConnectedAppResponse_element().getResult();
    new MetadataService.readApexPageResponse_element().getResult();
    new MetadataService.readProductSettingsResponse_element().getResult();
    new MetadataService.readLiveAgentSettingsResponse_element().getResult();
    new MetadataService.readOpportunitySettingsResponse_element().getResult();
    new MetadataService.readLiveChatDeploymentResponse_element().getResult();
    new MetadataService.readActivitiesSettingsResponse_element().getResult();
    new MetadataService.readLayoutResponse_element().getResult();
    new MetadataService.readWebLinkResponse_element().getResult();
    new MetadataService.readSiteDotComResponse_element().getResult();
    new MetadataService.readCompanySettingsResponse_element().getResult();
    new MetadataService.readHomePageLayoutResponse_element().getResult();
    new MetadataService.readDashboardResponse_element().getResult();
    new MetadataService.readAssignmentRulesResponse_element().getResult();
    new MetadataService.readAnalyticSnapshotResponse_element().getResult();
    new MetadataService.readEscalationRuleResponse_element().getResult();
    new MetadataService.readCustomSiteResponse_element().getResult();
    new MetadataService.readGroupResponse_element().getResult();
    new MetadataService.readReportTypeResponse_element().getResult();
    new MetadataService.readQuickActionResponse_element().getResult();
    new MetadataService.readCustomPageWebLinkResponse_element().getResult();
    new MetadataService.readApexComponentResponse_element().getResult();
    // new MetadataService.readBaseSharingRuleResponse_element().getResult();
    new MetadataService.readEntitlementTemplateResponse_element().getResult();
    new MetadataService.readFlexiPageResponse_element().getResult();
    new MetadataService.readWorkflowResponse_element().getResult();
    new MetadataService.readWorkflowActionResponse_element().getResult();
    new MetadataService.readAddressSettingsResponse_element().getResult();
    new MetadataService.readContractSettingsResponse_element().getResult();
    new MetadataService.readCustomObjectResponse_element().getResult();
    new MetadataService.readTranslationsResponse_element().getResult();
    new MetadataService.readRoleOrTerritoryResponse_element().getResult();
    new MetadataService.readApexTriggerResponse_element().getResult();
    new MetadataService.readCustomLabelsResponse_element().getResult();
    new MetadataService.readSecuritySettingsResponse_element().getResult();
    new MetadataService.readCallCenterResponse_element().getResult();
    new MetadataService.readPicklistValueResponse_element().getResult();
    new MetadataService.readRemoteSiteSettingResponse_element().getResult();
    new MetadataService.readQuoteSettingsResponse_element().getResult();
    new MetadataService.readSynonymDictionaryResponse_element().getResult();
    new MetadataService.readPostTemplateResponse_element().getResult();
    new MetadataService.readCustomTabResponse_element().getResult();
    new MetadataService.readLetterheadResponse_element().getResult();
    new MetadataService.readInstalledPackageResponse_element().getResult();
    new MetadataService.readQueueResponse_element().getResult();
    new MetadataService.readAuthProviderResponse_element().getResult();
    new MetadataService.readEntitlementSettingsResponse_element().getResult();
    new MetadataService.readCustomFieldResponse_element().getResult();
    new MetadataService.readStaticResourceResponse_element().getResult();
    new MetadataService.readEmailTemplateResponse_element().getResult();
    new MetadataService.readSharingReasonResponse_element().getResult();
    new MetadataService.readLiveChatButtonResponse_element().getResult();
    new MetadataService.readNetworkResponse_element().getResult();
    new MetadataService.readApprovalProcessResponse_element().getResult();
    new MetadataService.readMilestoneTypeResponse_element().getResult();
    new MetadataService.readAssignmentRuleResponse_element().getResult();
    new MetadataService.readCompactLayoutResponse_element().getResult();
    new MetadataService.readLiveChatAgentConfigResponse_element().getResult();
    new MetadataService.readAccountSettingsResponse_element().getResult();
    new MetadataService.readBusinessProcessResponse_element().getResult();
    new MetadataService.readFlowResponse_element().getResult();
    new MetadataService.readAutoResponseRuleResponse_element().getResult();
    new MetadataService.readPermissionSetResponse_element().getResult();
    new MetadataService.readBusinessHoursSettingsResponse_element().getResult();
    new MetadataService.readForecastingSettingsResponse_element().getResult();
    new MetadataService.readReportResponse_element().getResult();
    new MetadataService.readAppMenuResponse_element().getResult();
    new MetadataService.readListViewResponse_element().getResult();
    new MetadataService.readOrderSettingsResponse_element().getResult();
    new MetadataService.readCustomObjectTranslationResponse_element().getResult();
    new MetadataService.readCustomApplicationResponse_element().getResult();
    new MetadataService.readKnowledgeSettingsResponse_element().getResult();
    new MetadataService.readCaseSettingsResponse_element().getResult();
    new MetadataService.readApexClassResponse_element().getResult();
    new MetadataService.readPackageResponse_element().getResult();
    new MetadataService.readCommunityResponse_element().getResult();
    new MetadataService.readDocumentResponse_element().getResult();
    new MetadataService.readAutoResponseRulesResponse_element().getResult();
    new MetadataService.readFolderResponse_element().getResult();
    new MetadataService.readCustomApplicationComponentResponse_element().getResult();
    new MetadataService.readFieldSetResponse_element().getResult();
    new MetadataService.readSharingSetResponse_element().getResult();
    new MetadataService.readHomePageComponentResponse_element().getResult();

    new MetadataService.readReportFolderResponse_element().getResult();
    new MetadataService.readDashboardFolderResponse_element().getResult();
    new MetadataService.readFlowResponse_element().getResult();
    new MetadataService.readFlowResponse_element().getResult();
    new MetadataService.readDocumentFolderResponse_element().getResult();
    new MetadataService.readEmailFolderResponse_element().getResult();
    new MetadataService.readWorkflowTaskResponse_element().getResult();
    new MetadataService.readWorkflowSendResponse_element().getResult();
    new MetadataService.readWorkflowOutboundMessageResponse_element().getResult();
    new MetadataService.readWorkflowKnowledgePublishResponse_element().getResult();
    new MetadataService.readWorkflowFieldUpdateResponse_element().getResult();
    new MetadataService.readWorkflowAlertResponse_element().getResult();
    new MetadataService.readVisualizationPluginResponse_element().getResult();
    new MetadataService.readCustomMetadataResponse_element().getResult();
    new MetadataService.readNameSettingsResponse_element().getResult();
    new MetadataService.readMarketingActionSettingsResponse_element().getResult();
    new MetadataService.readCustomPermissionResponse_element().getResult();
    new MetadataService.readAuraDefinitionBundleResponse_element().getResult();
    new MetadataService.readCorsWhitelistOriginResponse_element().getResult();
    new MetadataService.readManagedTopicsResponse_element().getResult();
    new MetadataService.readTerritory2Response_element().getResult();
    new MetadataService.readTerritory2ModelResponse_element().getResult();
    new MetadataService.readTerritory2SettingsResponse_element().getResult();
    new MetadataService.readTerritory2TypeResponse_element().getResult();
    new MetadataService.readXOrgHubResponse_element().getResult();
    new MetadataService.readActionLinkGroupTemplateResponse_element().getResult();
    new MetadataService.readLicenseDefinitionResponse_element().getResult();
    new MetadataService.readMarketingResourceTypeResponse_element().getResult();
    new MetadataService.readMatchingRuleResponse_element().getResult();
    new MetadataService.readMatchingRulesResponse_element().getResult();
    new MetadataService.readNamedCredentialResponse_element().getResult();
    new MetadataService.readPersonalJourneySettingsResponse_element().getResult();
    new MetadataService.readSharingBaseRuleResponse_element().getResult();
    new MetadataService.readSharingCriteriaRuleResponse_element().getResult();
    new MetadataService.readSharingOwnerRuleResponse_element().getResult();
    new MetadataService.readSharingTerritoryRuleResponse_element().getResult();
    new MetadataService.readMetadataWithContentResponse_element().getResult();


} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.