Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @IsTest
- static void testMakeAValidationOnStatusChange() {
- Package_Order__c firstPackageOrder = new Package_Order__c();
- firstPackageOrder.Name = 'Specialized';
- firstPackageOrder.Address__c = 'Sredec 18';
- firstPackageOrder.Statuses__c = ConstantValuesOfTheProject.PICKLIST_APPROVED;
- firstPackageOrder.OwnerId = UserInfo.getUserId();
- insert firstPackageOrder;
- Test.startTest();
- try {
- firstPackageOrder.Statuses__c = ConstantValuesOfTheProject.PICKLIST_IN_TRANSIT;
- //тук гърми
- upsert firstPackageOrder;
- System.assert(false);
- } catch (ApplicationException e) {
- System.assert(e.getMessage().contains('Change of the status is not allowed if the User is owner of the order!'));
- }
- Test.stopTest();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement