function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ctonectone 

System.DmlException: Delete failed; first error: UNKNOWN_EXCEPTION, assertion failed

Hello-

I'm hoping some one can help me because I can't see what I am doing wrong here - in fact, this test case was working a few months ago but as of today it raises an exception.

All I am doing is creating an Opp, adding a line item, and then trying to delete that Opp.  At this point, I do not have any triggers activated

Code:
Account a = new Account(name = 'Test Account A');
insert a;
  
Opportunity opp = new Opportunity(name='Test Opp A', stageName='New', accountId = a.id, closeDate = Date.today(), Pricebook2Id = pbId);
insert opp;
  
//-- works OK
delete opp;
  
opp = new Opportunity(name='Test Opp A', stageName='New', accountId = a.id, closeDate = Date.today(), Pricebook2Id = pbId);
insert opp;

OpportunityLineItem oli = new OpportunityLineItem(OpportunityId = opp.id, UnitPrice=500.00, Quantity=1, pricebookentryid = pbeNames.get('SomeProduct'));
insert oli;
  
//-- fails: UNKNOWN_EXCEPTION
delete opp;

 The debug log shows the following:

20081001213343.803:Class.Test_Triggers.testOppMod: line 212, column 9: Delete: SOBJECT:Opportunity
20081001213343.803:Class.Test_Triggers.testOppMod: line 212, column 9:     DML Operation executed in 20 ms
System.DmlException: Delete failed. First exception on row 0 with id 006T0000003xKmiIAE; first error: UNKNOWN_EXCEPTION, assertion failed

 
Any one have any ideas?

--Chris

LosintikfosLosintikfos
Normally when you update your test class, i have realised simple things becomes thougher!
Anyway, try this to see if would resolve the issue >> Right Click on project >> Select Force.Com >> Choose Save to Server.


Normally this resolves any inconsistencies there, as you've made it clear;

Delete opp; do not trigger any event i believe also that it is not neccesary then.

Try invoke the instance of your class to gain higher coverage. Eg;

x stub = new x();

Hope this Helps!