Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <apex:page controller="TestBatchFiringController">
- </apex:page>
- public class TestBatchFiringController {
- public TestBatchFiringController() {
- // These statements successfully completed.
- // Results in a valid AsyncApexJob id, but batch does not execute.
- // AsyncApexJob Id is not valid after method executes (but it is in test context!)
- System.debug('My job id is: ' + Database.executeBatch(new TestBatchFiringBatch(), 1));
- // Results in a valid CronTrigger id, but schedulable does not execute.
- // CronTrigger Id is not valid after method executes (but it is in test context!)
- System.debug('My schedulable job id is ' + System.schedule('Test Job', '20 30 8 10 2 ?', new TestSchedulableFiring()));
- // This would fail with a `LimitException` - DML is not allowed.
- // Account a = new Account(Name = 'Testy Test Test');
- // insert a;
- // System.debug('My Account's Id is ' + a.Id);
- // Setting a savepoint is DML-equivalent - this also throws a `LimitException`
- // System.Savepoint sp = Database.setSavepoint();
- }
- }
Add Comment
Please, Sign In to add comment