You need to sign in to do that
Don't have an account?
anuraj
Email Test class
Hi,
I have written a email test class. But it is showing error
line breaks not allowed in string literals at line 13 column -1
my code is
@isTest private class mailTest { static testMethod void testMe() { Messaging.InboundEmail email = new Messaging.InboundEmail() ; Messaging.InboundEnvelope env = new Messaging.InboundEnvelope(); email.subject = 'Test Job Applicant'; email.fromname = 'Anu Raj'; env.fromAddress = 'someaddress@email.com'; mailTest.plainTextBody=('881754|GoToMyPc access involving host 10.1.6.240|12183|1523|9|4|1312984923|1|completed, 881755|Weather Bug activity from host 10.1.6.64|12183|1523|2|4|1313012808|1|completed, 882036|ZmEu Exploit Scan from 194.19.140.96|6837|8337|585|4|1313024634|1|completed, 882083|IBM Tivoli Storage Manager Express Backup counter heap corruption attempt|8367|8361|16244|4|1313038745|1|completed, 882124|EXPLOIT Internet Explorer DOM mergeAttributes memory corruption attempt |5269|5274|47|4|1313072552|1|completed, 882137|IRC traffic from 10.1.7.85|12183|6659|NULL|5|1313075416|1|completed, 882172|Host 10.1.6.162 is infected with Bredolab malware.|12183|6659|2|8|1313074351|1|completed'); mailprocess emailProcess = new mailprocess(); emailProcess.handleInboundEmail(email, env); Account a = new Account(); Case contact = [select account__c, begin_date__c, notification_approved__c, incident__c, created__c from case where account__c = :a.accountid__c]; System.assertEquals(contact.account__c,'Account'); System.assertEquals(contact.begin_date__c,'begin_date__c'); System.assertEquals(contact.notification_approved__c,'notification_approved__c'); System.assertEquals(contact.incident__c,'incident__c'); // a = [select name from attachment where parentId = :contact.id]; System.assertEquals(a.name,'textfile.txt'); } }
pleas help me
Thanks
Anuraj
This line:
Looks like you have some carriage returns in it. Is that the case, or is that something that the editor has put in?
Hi Anuraj,
Try changing line no. 13 to this :
email.plainTextBody='881754|GoToMyPc access involving host 10.1.6.240|12183|1523|9|4|1312984923|1|completed, 881755|Weather Bug activity from host 10.1.6.64|12183|1523|2|4|1313012808|1|completed, 882036|ZmEu Exploit Scan from 194.19.140.96|6837|8337|585|4|1313024634|1|completed, 882083|IBM Tivoli Storage Manager Express Backup counter heap corruption attempt|8367|8361|16244|4|1313038745|1|completed, 882124|EXPLOIT Internet Explorer DOM mergeAttributes memory corruption attempt |5269|5274|47|4|1313072552|1|completed, 882137|IRC traffic from 10.1.7.85|12183|6659|NULL|5|1313075416|1|completed, 882172|Host 10.1.6.162 is infected with Bredolab malware.|12183|6659|2|8|1313074351|1|completed';
Just copy the string on to notepad and remove the line breaks. That should do.