@isTest private class LayoutDescriberHelperTest { static testMethod void testMethod1() { String userMode = 'classic';//classic lightning String objectType = 'Contact'; String recordTypeId = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Doctor').getRecordTypeId(); Map detailsMap = new Map(); Map detailsMap2 = new Map(); Map detailsMap3 = new Map(); detailsMap.put('calculated',true); detailsMap.put('autoNumber',false); detailsMap.put('type','address'); detailsMap2.put('calculated',false); detailsMap2.put('autoNumber',false); detailsMap2.put('type','repair'); detailsMap3.put('calculated',false); detailsMap3.put('autoNumber',false); detailsMap3.put('type','repair'); List> componentMapList = new List>(); List> componentMapList2 = new List>(); List> componentMapList3 = new List>(); Map componentMap = new Map(); Map componentMap2 = new Map(); Map componentMap3 = new Map(); componentMap.put('value','Name'); componentMap.put('type','Field'); componentMap.put('details',detailsMap); componentMapList.add(componentMap); componentMap2.put('value','Name'); componentMap2.put('type','Field'); componentMap2.put('details',detailsMap2); componentMapList2.add(componentMap2); componentMap3.put('value','LastName'); componentMap3.put('type','Field'); componentMap3.put('details',detailsMap3); componentMapList3.add(componentMap3); List> layoutComponentsList = new List>(); Map layoutComponents = new Map(); layoutComponents.put('layoutComponents',componentMapList); layoutComponents.put('label','Address'); layoutComponents.put('placeholder',true); layoutComponents.put('editableForNew',true); layoutComponents.put('required',false); layoutComponentsList.add(layoutComponents); Map layoutComponents2 = new Map(); layoutComponents2.put('layoutComponents',componentMapList2); layoutComponents2.put('label','Repair'); layoutComponents2.put('placeholder',true); layoutComponents2.put('editableForNew',true); layoutComponents2.put('required',false); layoutComponentsList.add(layoutComponents2); Map layoutComponents3 = new Map(); layoutComponents3.put('layoutComponents',componentMapList3); layoutComponents3.put('label','Repair'); layoutComponents3.put('placeholder',true); layoutComponents3.put('editableForNew',true); layoutComponents3.put('required',false); layoutComponentsList.add(layoutComponents3); List> itemList = new List>(); Map item = new Map(); item.put('layoutItems',layoutComponentsList); itemList.add(item); List> sectionList = new List>(); Map section = new Map(); section.put('heading',''); section.put('useHeading',true); section.put('columns',1); section.put('useCollapsibleSection',true); section.put('layoutRows',itemList); sectionList.add(section); Map layoutSection = new Map(); layoutSection.put('layouts','123'); layoutSection.put('editLayoutSections',sectionList); String layoutSectionJson = JSON.serialize(layoutSection); LayoutDescriberHelper.ControllerUtil(); Test.setMock(HttpCalloutMock.class, new TestDataUtility.BaseHttpMock(layoutSectionJson,'OK','200')); Test.startTest(); LayoutDescriberHelper.describeSectionWithFieldsWrapper(recordTypeId,objectType,userMode); LayoutDescriberHelper.describeSectionWithFieldsWrapper(null,objectType,userMode); Test.stopTest(); } }