@isTest
public class MetaDataUtilityTest {
    
    @isTest
    static void Test1(){
        /*
        Test.setMock(HttpCalloutMock.class, new CalloutMockContainer('{"size":1,"totalSize":1,"done":true,"queryLocator":null,"entityTypeName":"Layout","records":[{"attributes":{"type":"Layout","url":"/services/data/v41.0/tooling/sobjects/Layout/00h28000001ReZhAAK"},"Id":"00h28000001ReZhAAK","Name":"Order Product Layout","TableEnumOrId":"OrderItem","LayoutType":"Standard"}]}'));
        MetaDataUtility.GetRecordTypePageLayout(null, 'OrderItem');
        Test.setMock(HttpCalloutMock.class, new CalloutMockContainer('{"size":4,"totalSize":4,"done":true,"queryLocator":null,"entityTypeName":"ProfileLayout","records":[{"attributes":{"type":"ProfileLayout","url":"/services/data/v41.0/tooling/sobjects/ProfileLayout/01G0T00000AowJEUAZ"},"Layout":{"attributes":{"type":"Layout","url":"/services/data/v41.0/tooling/sobjects/Layout/00h28000001ReZOAA0"},"Name":"Case Layout","TableEnumOrId":"Case"},"ProfileId":"00e28000000wAuNAAU","Profile":{"attributes":{"type":"Profile","url":"/services/data/v41.0/tooling/sobjects/Profile/00e28000000wAuNAAU"},"Name":"系统管理员"},"RecordTypeId":"0120T00000023R0QAI"},{"attributes":{"type":"ProfileLayout","url":"/services/data/v41.0/tooling/sobjects/ProfileLayout/01G0T00000AowMSUAZ"},"Layout":{"attributes":{"type":"Layout","url":"/services/data/v41.0/tooling/sobjects/Layout/00h0T000000dswbQAA"},"Name":"Case LayoutApproval","TableEnumOrId":"Case"},"ProfileId":"00e28000000wAuNAAU","Profile":{"attributes":{"type":"Profile","url":"/services/data/v41.0/tooling/sobjects/Profile/00e28000000wAuNAAU"},"Name":"系统管理员"},"RecordTypeId":"0120T00000023R5QAI"},{"attributes":{"type":"ProfileLayout","url":"/services/data/v41.0/tooling/sobjects/ProfileLayout/01G0T00000AowPgUAJ"},"Layout":{"attributes":{"type":"Layout","url":"/services/data/v41.0/tooling/sobjects/Layout/00h0T000000dswbQAA"},"Name":"Case LayoutApproval","TableEnumOrId":"Case"},"ProfileId":"00e28000000wAuNAAU","Profile":{"attributes":{"type":"Profile","url":"/services/data/v41.0/tooling/sobjects/Profile/00e28000000wAuNAAU"},"Name":"系统管理员"},"RecordTypeId":"0120T00000023RAQAY"},{"attributes":{"type":"ProfileLayout","url":"/services/data/v41.0/tooling/sobjects/ProfileLayout/01G2800000HvfFWEAZ"},"Layout":{"attributes":{"type":"Layout","url":"/services/data/v41.0/tooling/sobjects/Layout/00h28000001ReZOAA0"},"Name":"Case Layout","TableEnumOrId":"Case"},"ProfileId":"00e28000000wAuNAAU","Profile":{"attributes":{"type":"Profile","url":"/services/data/v41.0/tooling/sobjects/Profile/00e28000000wAuNAAU"},"Name":"系统管理员"},"RecordTypeId":null}]}'));
        MetaDataUtility.GetRecordTypePageLayout(null, 'Case');*/
        
        Test.setMock(HttpCalloutMock.class, new CalloutMockContainer('{"size":3,"totalSize":3,"done":true,"queryLocator":null,"entityTypeName":"ProfileLayout","records":[{"attributes":{"type":"ProfileLayout","url":"/services/data/v41.0/tooling/sobjects/ProfileLayout/01G2800000wKyt5EAC"},"Layout":{"attributes":{"type":"Layout","url":"/services/data/v41.0/tooling/sobjects/Layout/00h28000003OBy1AAG"},"Name":"Contact layout for dealer Approval","TableEnumOrId":"Contact"},"ProfileId":"00e28000000wAuNAAU","Profile":{"attributes":{"type":"Profile","url":"/services/data/v41.0/tooling/sobjects/Profile/00e28000000wAuNAAU"},"Name":"系统管理员"},"RecordTypeId":"01228000000PvwMAAS"},{"attributes":{"type":"ProfileLayout","url":"/services/data/v41.0/tooling/sobjects/ProfileLayout/01G2800000wKysdEAC"},"Layout":{"attributes":{"type":"Layout","url":"/services/data/v41.0/tooling/sobjects/Layout/00h28000001ReZNAA0"},"Name":"Contact Layout","TableEnumOrId":"Contact"},"ProfileId":"00e28000000wAuNAAU","Profile":{"attributes":{"type":"Profile","url":"/services/data/v41.0/tooling/sobjects/Profile/00e28000000wAuNAAU"},"Name":"系统管理员"},"RecordTypeId":"01228000000PvwLAAS"},{"attributes":{"type":"ProfileLayout","url":"/services/data/v41.0/tooling/sobjects/ProfileLayout/01G2800000HvfFYEAZ"},"Layout":{"attributes":{"type":"Layout","url":"/services/data/v41.0/tooling/sobjects/Layout/00h28000001ReZNAA0"},"Name":"Contact Layout","TableEnumOrId":"Contact"},"ProfileId":"00e28000000wAuNAAU","Profile":{"attributes":{"type":"Profile","url":"/services/data/v41.0/tooling/sobjects/Profile/00e28000000wAuNAAU"},"Name":"系统管理员"},"RecordTypeId":null}]}'));
        MetaDataUtility.GetRecordTypePageLayout(null, 'Contact');
        
        
    }
    
    class CalloutMockContainer implements HttpCalloutMock {
        
        string body;
        public CalloutMockContainer(string body){
            this.body = body;
        }
        
        // 实现这个接口方法
        public HTTPResponse respond(HTTPRequest request) {
            // 创建一个假的回应
            HttpResponse response = new HttpResponse();
            response.setHeader('Content-Type', 'application/json');
            response.setBody(body);
            response.setStatus('ok');
            response.setStatusCode(200);
            return response; 
        }
    }
}