The question might be a little vague. I'll try to give more context!
Basically, I have a trigger that in one scenario, a variable (sentEmail) is set to true, and in others, it's set to false.
In my test, I want to confirm that after one test scenario, the variable was set to true (thus, the test actually tests that an email was sent in one case), and in the other case, I want to confirm that it's still false (no email should be sent).
So I have a public boolean returnStatus() method that returns this variable...but I don't know how to retrieve this. For example, if my trigger were a class, I could simply reference in the test class, myClass.theMethod()
This doesn't seem to be the same case with boolean someVal = myTrigger.theMethod();
Knowing what I'm trying to accomplish, how can I go about this?
I don't want my test to just have code coverage; I want it to actually represent scenarios and validate the outcomes. Thoughts?
trigger updateAlert on customObject__c(after update){
boolean sentEmail = False;
for(CustomObject__c o : trigger.new){
// other code happening here...
// . . . fast forward to . . .
sentEmail = True;
}
public boolean returnStatus(){
return sentEmail;
}
}
I included that last method thinking I could call it from my test to retrieve that variable. How else can I grab it?