@isTest private class AssetMaintainDetailHandlerTest { static testMethod void testMethod1() { AssetMaintainHeader__c header = new AssetMaintainHeader__c(); header.MaintainType__c = '冻结'; header.Date__c = System.today(); insert header; AssetMaintainDetail__c amd = new AssetMaintainDetail__c(); amd.OrderNumber__c = 1; amd.AssetMaintainHeader__c = header.Id; amd.MaintainType__c = '冻结'; insert amd; amd = [SELECT Name FROM AssetMaintainDetail__c LIMIT 1]; System.assertEquals('WHD-DJ' + System.now().format('-YYYYMM-') + '0001', amd.Name); } }