How do I call a method in my test class which is basically been called from the action function on the vf page?
VF page:
<button type="button" onclick="myJSMethod();">my button</button>
<script>
function myJSMethod() {
//code
callControllerMethod(param);
}
</script>
<apex:actionFunction name="callControllerMethod" action={!myControllerMethod}>
<apex:param name="param" value="" assignTo="{!someVar}"/>
</apex:actionFunction>
Controller
public with sharing class MyClass {
public String someVar {get; set;}
public void myControllerMethod() {
//code
}
}
I want to call the myControllerMethod in my test class method.
When I do something like this in my test method
MyClass class = new MyClass();
class.myControllerMethod();
I get de-reference null error. Is there a way to call that method?