buli
2022-04-08 b6f2c55d21463def425048aba48bed273156e9a9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
@isTest
private class SoqlHelperTest {
    static testMethod void testMethod1() {
        String sql = 'SELECT Id,Name FROM Contact WHERE Name != null Limit 1';
        Account accupdate = TestDataUtility.CreateAccounts(1)[0];
        accupdate.Name = 'update1';
        List<Account> updateAccList = new List<Account>();
 
        //Profile p = [select Id from Profile where Name = 'System Administrator'];
        Profile p = [select Id from Profile where Name = 'Chatter Free User'];
        User hpOwner = new User( LastName = 'TestUserA', FirstName = 'owner', Alias = 'hp', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        List<User> userList = new List<User>();
 
        userList.add(hpOwner);
 
        Contact con = TestDataUtility.CreateContacts(1)[0];
        List<String> conidList = new List<String>();
        conidList.add(con.Id); 
 
        Set<String> strSet = new Set<String>();
        strSet.add('test1');
        strSet.add('test2');
        
        List<AggregateResult> lartest = new List<AggregateResult>();
        //Repair__c repair1 = new Repair__c();
        //repair1.Name = 'test';
        //repair1.RecordTypeId = '0120K000000wOGcQAM';
        //insert repair1;
        lartest = [select count(Id) total from Repair__c where RecordTypeId != null group by RecordTypeId];
        system.debug('lartest:'+lartest);
        String key = 'test';
        Test.startTest();
        //ToInCondition
        //UpsertList
        SoqlHelper.ToInCondition(strSet);
        SoqlHelper.ToInCondition(lartest, key);
        SoqlHelper.DistinctQueryFields(sql);
        SoqlHelper.WId(sql);
        SoqlHelper.InsertList(userList);
        SoqlHelper.UpdateList(updateAccList);
        SoqlHelper.DeleteList(updateAccList);
        SoqlHelper.DeleteListAsync(conidList);
        Test.stopTest();
 
    }
}