• Ubisense Support
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 5
    Replies

For some odd reason my Trigger won't deploy because some unrelated test class is failing. Why would my unrelated "Case" trigger cause an "Opportunity" trigger test class to fail?

 

Failure Message: "System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId (pricebook entry currency code does not match opportunity currency code): [PricebookEntryId]", Failure Stack Trace: "Class.Opp_Trigger_Prod_Qty_Summary_Test_Class.val...

 

We get a ton of spam cases coming into SF so we created a formula field that evaluates to TRUE when the case is 7 days old and the Owner of the case is set to a specific Queue which happens to be the spam queue.

 

I want to trigger off of this formula field and delete the case. Thus far I have:

 

TRIGGER_____________________________________________________

 

trigger DeleteUnknownCaseTrigger on Case (after update, after insert) {


List<Case> lstCaseToDelete = new List<Case>();

for(Case c : trigger.new) {
if(c.QUEUE_UNKNOWN_DELETE__c == TRUE){

Case cDel = new Case(Id=c.Id);
lstCaseToDelete.add(cDel);
}
}

delete lstCaseToDelete;

_____________________________________________________________________________

 

Test Class

_____________________________________________________________________________

@isTest
private class UnknownCaseTriggerDeleteTestClass {
static testMethod void validateTrigger() {
Date myDate = date.newInstance(2013, 6, 1);

Case c = new Case(
OwnerId = '00G20000000ltb9',
Status = 'New',
Subject = 'Test Case',
Description = 'Case Description'
);

insert c;



c.Estimated_Completion_Date__c = myDate;
}
}

________________________________________________________________________________

 

The problem is that the Trigger is only 66% covered and it complains that code inside the if statement isn't covered. I am new to apex so I thought the by setting the date of Estimated Completion Date it would cause the formula to fire and thus test that loop. What am I doing wrong?

 

For some odd reason my Trigger won't deploy because some unrelated test class is failing. Why would my unrelated "Case" trigger cause an "Opportunity" trigger test class to fail?

 

Failure Message: "System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId (pricebook entry currency code does not match opportunity currency code): [PricebookEntryId]", Failure Stack Trace: "Class.Opp_Trigger_Prod_Qty_Summary_Test_Class.val...

 

We get a ton of spam cases coming into SF so we created a formula field that evaluates to TRUE when the case is 7 days old and the Owner of the case is set to a specific Queue which happens to be the spam queue.

 

I want to trigger off of this formula field and delete the case. Thus far I have:

 

TRIGGER_____________________________________________________

 

trigger DeleteUnknownCaseTrigger on Case (after update, after insert) {


List<Case> lstCaseToDelete = new List<Case>();

for(Case c : trigger.new) {
if(c.QUEUE_UNKNOWN_DELETE__c == TRUE){

Case cDel = new Case(Id=c.Id);
lstCaseToDelete.add(cDel);
}
}

delete lstCaseToDelete;

_____________________________________________________________________________

 

Test Class

_____________________________________________________________________________

@isTest
private class UnknownCaseTriggerDeleteTestClass {
static testMethod void validateTrigger() {
Date myDate = date.newInstance(2013, 6, 1);

Case c = new Case(
OwnerId = '00G20000000ltb9',
Status = 'New',
Subject = 'Test Case',
Description = 'Case Description'
);

insert c;



c.Estimated_Completion_Date__c = myDate;
}
}

________________________________________________________________________________

 

The problem is that the Trigger is only 66% covered and it complains that code inside the if statement isn't covered. I am new to apex so I thought the by setting the date of Estimated Completion Date it would cause the formula to fire and thus test that loop. What am I doing wrong?