@isTest private class LicenseCheckUtilTest { static testMethod void testMethod1() { List rectIE = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer IE']; Account acc1 = new Account( name = '*', RecordTypeId = rectIE[0].Id, OwnerId = UserInfo.getUserId(), DivisionName__c = 'Customer IE', FacilityName__c = 'abc', DivisionName_D__c = 'Customer IE', FacilityNameD__c = 'abc', AccountStatus__c = 'Cancel', PostCode__c = '123456' ); insert acc1; License_Information__c li = new License_Information__c( name = 'test', LicenseType__c = '辐射安全许可证', ValidFrom__c = Date.today().addDays(-5), LicenseAndAccount__c = acc1.Id, ValidTo__c = Date.today().addDays(4) ); insert li; LicenseCheckUtil.LicenseCheck1(acc1.Id); LicenseCheckUtil.LicenseCheck1('111'); li.ValidTo__c = Date.today().addDays(-3); update li; LicenseCheckUtil.LicenseCheck1(acc1.Id); } static testMethod void testMethod2() { List rectIE = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer IE']; Account acc1 = new Account( name = '*', RecordTypeId = rectIE[0].Id, OwnerId = UserInfo.getUserId(), DivisionName__c = 'Customer IE', FacilityName__c = 'abc', DivisionName_D__c = 'Customer IE', FacilityNameD__c = 'abc', AccountStatus__c = 'Cancel', PostCode__c = '123456' ); insert acc1; License_Information__c li = new License_Information__c( name = 'test', LicenseType__c = '第二类医疗器械经营备案凭证', ValidFrom__c = Date.today().addDays(-5), LicenseAndAccount__c = acc1.Id, StorageAddress__c = '1111', ValidTo__c = Date.today().addDays(4) ); insert li; LicenseCheckUtil.AddressCheck(acc1.Id,'1111'); LicenseCheckUtil.AddressCheck(acc1.Id,'111111'); } static testMethod void testMethod3() { List rectIE = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer IE']; Account acc1 = new Account( name = '*', RecordTypeId = rectIE[0].Id, OwnerId = UserInfo.getUserId(), DivisionName__c = 'Customer IE', FacilityName__c = 'abc', DivisionName_D__c = 'Customer IE', FacilityNameD__c = 'abc', AccountStatus__c = 'Cancel', PostCode__c = '123456' ); insert acc1; License_Information__c li = new License_Information__c( name = 'test', LicenseType__c = '第二类医疗器械经营备案凭证', ValidFrom__c = Date.today().addDays(-5), LicenseAndAccount__c = acc1.Id, StorageAddress__c = '1111', ValidTo__c = Date.today().addDays(4) ); insert li; License_Information__c li1 = new License_Information__c( name = 'test', LicenseType__c = '营业执照', ValidFrom__c = Date.today().addDays(-5), LicenseAndAccount__c = acc1.Id, StorageAddress__c = '1111', ValidTo__c = Date.today().addDays(4) ); insert li1; LicenseCheckUtil.LicenseCheck(acc1.Id); } }