You need to sign in to do that
Don't have an account?
Jordan Torrey
System.List.Exception:Before Insert or Upsert list must not have two identically equal elements
/*Stack Trace: Class.DynamicDataCapture.setup: line 1350, column 1 Class.DynamicDataCapture.testNegativeTestCases: line 1423, column 1 */ // Line 1350 is pointing to my "catch" statement below - end of list: lstobjDDC.add(objDDC83); try{ Database.insert(lstobjDDC); } catch(DmlException e){ system.debug('Exception: '+e.getMessage()); } } //Exception is pointing to the setup(): public static testMethod void testPositiveTestCases(){ setup(); // <----- Line 1365 (exception) Test.startTest(); List<AEXP_Dynamic_Data_Capture__c> lstDDC = new List<AEXP_Dynamic_Data_Capture__c>(); lstDDC = [Select Id from AEXP_Dynamic_Data_Capture__c where Enrollment__c = 'a694B00000003wdQAA' ]; system.assert(lstDDC.size() == 83); Test.stopTest(); Exception is pointing to setup() static testMethod void testNegativeTestCases() { setup(); <---- Line 1423(exception) Test.startTest(); List<AEXP_Dynamic_Data_Capture__c> lstDDC1 = new List<AEXP_Dynamic_Data_Capture__c>(); lstDDC1 = [Select Id from AEXP_Dynamic_Data_Capture__c where Enrollment__c = 'a694B00000003wdQAA' ]; system.assert(lstDDC1.size() != 83); Test.stopTest(); Im extremely new to apex, so please let me know if my example is even legible, and if you need a more detailed question. Any insight would be of great help. Thanks in advance :)
Can you us know what record(s) you have in the list which you are Inserting?
Looks like you have same record twice in the List which is getting Inserted.
Kindly mark solved if this helps
Veenesh