Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @isTest
- public class CaseStatusChangeBatchTester {
- static testMethod void CaseStatusChangeBatchUnitTest() {
- Account testAcc = new Account();
- testAcc.Name = 'Test Account';
- insert testAcc;
- Contact cont = new Contact(AccountId = acc.Id, FirstName = 'Test', LastName = 'Contact1');
- insert cont;
- Case[] cas = new List<Case>();
- for (Integer i=0; i<20; i++) {
- Case cases = new Case(Subject = 'Tst Case', AccountId = testAcc.Id, ContactId = cont.Id, Status= 'New');
- cas.add(cases);
- }
- insert cas;
- for (Case c : cas) {
- c.Status = 'Progress';
- }
- update cas;
- Test.startTest();
- CaseStatusChangeBatch cst = new CaseStatusChangeBatch();
- Database.executeBatch(cst);
- Test.stopTest();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement