[SalesForce] How to Access Remote Action From Test Class

How can I access a remote action from a test class? Here is what I have so far:

public static Boolean createCaseRA(String newJCase,String prevCase){
    system.debug('Remote Prev Case>>>>'+prevCase);
    Case prevDTCase = new Case();

Best Answer

Accessing a remote action method is the same as accessing any other static method:

@isTest static void test() {
  // Set up your data first
  // Then...
  String newJCaseParam = ..., prevCaseParam = ...;
  Boolean expectedResult = true, // or false, whatever you expect
    result = ClassName.createCaseRA(newJCaseParam, prevCaseParam);
  System.assertEquals(expectedResult, result);
Related Topic