Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. @isTest
  2. public class CaseStatusChangeBatchTester {
  3.  
  4. static testMethod void CaseStatusChangeBatchUnitTest() {
  5.  
  6. Account testAcc = new Account();
  7. testAcc.Name = 'Test Account';
  8. insert testAcc;
  9.  
  10. Contact cont = new Contact(AccountId = acc.Id, FirstName = 'Test', LastName = 'Contact1');
  11. insert cont;
  12.  
  13. Case[] cas = new List<Case>();
  14. for (Integer i=0; i<20; i++) {
  15. Case cases = new Case(Subject = 'Tst Case', AccountId = testAcc.Id, ContactId = cont.Id, Status= 'New');
  16. cas.add(cases);
  17. }
  18. insert cas;
  19.  
  20. for (Case c : cas) {
  21. c.Status = 'Progress';
  22. }
  23. update cas;
  24.  
  25. Test.startTest();
  26. CaseStatusChangeBatch cst = new CaseStatusChangeBatch();
  27. Database.executeBatch(cst);
  28. Test.stopTest();
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement