You need to sign in to do that
Don't have an account?
Michael M
Help with test code for basic invocable class
Hello, would someone be able to show me how to write test code for this class of mine:
public with sharing class FetchCurrentURL {
public class VisitorUrlOutput {
@InvocableVariable(required=false)
public String urlOfMostRecentPage;
}
@InvocableMethod(label='Get Current URL' description='Returns Current URL')
public static List<String> getcurrentURL() {
System.debug(URL.getSalesforceBaseUrl().toExternalForm());
return new List<String>{URL.getSalesforceBaseUrl().toExternalForm()};
}
}
public with sharing class FetchCurrentURL {
public class VisitorUrlOutput {
@InvocableVariable(required=false)
public String urlOfMostRecentPage;
}
@InvocableMethod(label='Get Current URL' description='Returns Current URL')
public static List<String> getcurrentURL() {
System.debug(URL.getSalesforceBaseUrl().toExternalForm());
return new List<String>{URL.getSalesforceBaseUrl().toExternalForm()};
}
}
@isTest
public class FetchCurrentURLTest {
static testMethod void myUnitTest(){
FetchCurrentURL.getcurrentURL();
}
}
This will give you 100% coverage for FetchCurrentURL class.
All Answers
@isTest
public class FetchCurrentURLTest {
static testMethod void myUnitTest(){
FetchCurrentURL.getcurrentURL();
}
}
This will give you 100% coverage for FetchCurrentURL class.