I am writing an after insert, after update trigger for a custom object CustomA_c. On changing the status field of this custom object to some value I need to create another custom object CustomB_c and insert it.
trigger triggerOnObj on CustomA__c (after insert, after update) {
List<CustomA__c> listOfCustomA = [select field1,field2 from CustomA__c where Status__c = 'picklist value'];
List<CustomB__c> listOfCustomB = new List<CustomB__c>();
for(CustomA__c customObj: listOfCustomA) {
CustomB__c customB = new CustomB__c();
listOfCustomB.add(customB);
//some other trigger related code
}
insert listOfCustomB;
}
Both the custom objects A and B are unrelated. They do not have look-up to one another. My problem is when writing a test method/class for this trigger, how do I check if the for loop did inserted that many new B custom objects.