You need to sign in to do that
Don't have an account?
Vaibhav Sule
Test Classes - assignment error "unexpected token '='"
Hello, I am a complete noob to salesforce. I am trying to test the InboundEmailHandler, and I wrote the following test class:
@IsTest
private class MMmeetingemailTest
{
Messaging.InboundEmail email1 = new Messaging.InboundEmail();
Messaging.InboundEnvelope env1 = new Messaging.InboundEnvelope();
// Create the email body
email1.plainTextBody = 'This should become a note';
email1.fromAddress = 'test@test.com';
string contactEmail = 'jsmith@salesforce.com';
email1.subject = 'a01O000000ZW5mo';
MMmeetingemail mmemail = new MMmeetingemail();
Test.startTest();
Messaging.InboundEmailResult result = mmemail.handleInboundEmail(email1,env1);
Test.stopTest();
System.assert (result.success , 'InboundEmailResult returned a failure message');
}
However, I keep getting the following error: "unexpected token: '=' " for the line " email1.plainTextBody = 'This should become a note'; "
I don't understand what is incorrect here, since I am simply trying to assign a value to a valid object property.
Any help is appreciated.
Thanks!
@IsTest
private class MMmeetingemailTest
{
Messaging.InboundEmail email1 = new Messaging.InboundEmail();
Messaging.InboundEnvelope env1 = new Messaging.InboundEnvelope();
// Create the email body
email1.plainTextBody = 'This should become a note';
email1.fromAddress = 'test@test.com';
string contactEmail = 'jsmith@salesforce.com';
email1.subject = 'a01O000000ZW5mo';
MMmeetingemail mmemail = new MMmeetingemail();
Test.startTest();
Messaging.InboundEmailResult result = mmemail.handleInboundEmail(email1,env1);
Test.stopTest();
System.assert (result.success , 'InboundEmailResult returned a failure message');
}
However, I keep getting the following error: "unexpected token: '=' " for the line " email1.plainTextBody = 'This should become a note'; "
I don't understand what is incorrect here, since I am simply trying to assign a value to a valid object property.
Any help is appreciated.
Thanks!
Try with the below code. For more see the below links.
https://developer.salesforce.com/forums/ForumsMain?id=906F000000091VBIAY
http://blog.jeffdouglas.com/2010/03/12/writing-an-inbound-email-service-for-salesforce-com/
All Answers
Try with the below code. For more see the below links.
https://developer.salesforce.com/forums/ForumsMain?id=906F000000091VBIAY
http://blog.jeffdouglas.com/2010/03/12/writing-an-inbound-email-service-for-salesforce-com/