@isTest private class FixtureRemindSnapshotHandlerTest { static testMethod void testMethod1() { FixtureRemindSnapshot__c frs1 = new FixtureRemindSnapshot__c(Dai_Fen_Pei_Cnt__c = 1 , Region__c = '北方' , Time__c ='14:00' , Date__c = System.today() ); insert frs1; FixtureRemindSnapshot__c frs2 = [SELECT Name, UniqueKey__c FROM FixtureRemindSnapshot__c WHERE Id=:frs1.Id]; System.assertEquals(System.now().format('yyyy-MM-dd') + ':14:00:北方', frs2.UniqueKey__c); System.assertEquals(System.now().format('yyyy-MM-dd') + ':14:00:北方', frs2.Name); frs2.Time__c = '15:00'; frs2.Region__c = '南方'; frs2.Date__c = System.today().addDays(1); update frs2; FixtureRemindSnapshot__c frs3 = [SELECT Name, UniqueKey__c FROM FixtureRemindSnapshot__c WHERE Id=:frs1.Id]; System.assertEquals(System.now().addDays(1).format('yyyy-MM-dd') + ':15:00:南方', frs3.UniqueKey__c); System.assertEquals(System.now().addDays(1).format('yyyy-MM-dd') + ':15:00:南方', frs3.Name); } }