• Jesse Foutch
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hey guys, I'm attempting to write a test class for what I feel is a pretty simple controller. I'm learning all of this stuff so I don't know what I'm doing just yet. I went throught the trailhead and wrote the 2 test classes there which helped a little. Basically the controller I have (taken of the internet but works for what I need) checks for an existing contact then creates a lead if it doesn't exist already. This is for the liveagent chat module if that matters. Here is the code below. I tried to post this on salesforce stack exchange but got the impression I need to be more advanced to post anything there. I would appreciate any help! thanks!
 
public class LiveAgent_preChatRemoting_Con
{
public LiveAgent_preChatRemoting_Con(ApexPages.StandardController controller)
{
 
}
@RemoteAction
public static contact getcontact(string contactemail)
{
Contact testContact=new Contact();
testContact=[Select Id,Name from Contact where email=:contactemail limit 1];
return testContact;
}
 
}

Here is were I attempted to get started on a test class and hit a brick wall:
 
@isTest
public class LiveAgent_preChatRemoting_ConTests {
    public static testMethod void testMyController() {
        Contact testContact = new Contact();
        testContact = 'test@email.com';
        return testContact;
    }
}