Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. @IsTest
  2. static void testMakeAValidationOnStatusChange() {
  3. Package_Order__c firstPackageOrder = new Package_Order__c();
  4. firstPackageOrder.Name = 'Specialized';
  5. firstPackageOrder.Address__c = 'Sredec 18';
  6. firstPackageOrder.Statuses__c = ConstantValuesOfTheProject.PICKLIST_APPROVED;
  7. firstPackageOrder.OwnerId = UserInfo.getUserId();
  8. insert firstPackageOrder;
  9. Test.startTest();
  10. try {
  11. firstPackageOrder.Statuses__c = ConstantValuesOfTheProject.PICKLIST_IN_TRANSIT;
  12. //тук гърми
  13. upsert firstPackageOrder;
  14. System.assert(false);
  15. } catch (ApplicationException e) {
  16. System.assert(e.getMessage().contains('Change of the status is not allowed if the User is owner of the order!'));
  17. }
  18. Test.stopTest();
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement