-
Notifications
You must be signed in to change notification settings - Fork 13
MethodSignature
APIVERSION: 58
STATUS: ACTIVE
Class models a callable apex method's 'signature' or combination of Name, Parameter types and Parameter values. This is separate from a MockedMethod, because it can be constructed at runtime for comparison against established MockedMethods.
Constructor requiring a method name and list of parameters. This method cannot be constructed without these.
Param | Description |
---|---|
methodName |
String Name of the method to be mocked |
paramTypes |
List<System.Type> of the parameters for the method |
TESTVISIBLE
TESTVISIBLE
This is used to compare the signature of a MockedMethod, against another instance. Used at runtime to compare an actually requested method call against pre-defined mocks.
Param | Description |
---|---|
otherSignature |
the secondary MethodSignature object to compare against |
Type | Description |
---|---|
Boolean |
Boolean true if the signatures match, false if they do not |
private static Boolean verifyMethodNamesMatch(String originalMethodName, String comparatorMethodName)
Returns true if the current MethodSignature's methodName is a case insensitive match to the comparison's methodName
Param | Description |
---|---|
originalMethodName |
String name of the method name called |
comparatorMethodName |
String name of the method name to compare |
Type | Description |
---|---|
Boolean |
Boolean true if the method names match, |
returns the method name for this signature
Type | Description |
---|---|
String | String method name |
While a MethodSignature object can be created directly the more common use case is to use this Builder class to construct the MethodSignature object in a Fluent api style.
Constructor.
Param | Description |
---|---|
builder |
A Stub.Builder object |
methodName |
String referencing the name of the method minus things like () |
paramTypes |
A list of System.Types that define the order and type of parameters for the method. |
TESTVISIBLE
This variant handles the situation where a mocked method was called without parameters.
Type | Description |
---|---|
MockedMethod | MockedMethod.Builder |
Omnibus variant that handles a list(N) of parameters.
Param | Description |
---|---|
parameters |
List<System.Type> of parameters |
Type | Description |
---|---|
MockedMethod | MockedMethod.Builder |
This variant handles a single parameter, brokers to omnibus method.
Param | Description |
---|---|
parameter |
Type of the parameter |
Type | Description |
---|---|
MockedMethod | MockedMethod.Builder |
Two parameter variant. Brokers to omnibus method.
Param | Description |
---|---|
parameter |
Type of the parameter |
parameter2 |
Type of the second parameter |
Type | Description |
---|---|
MockedMethod | MockedMethod.Builder |
Three parameter variant. Brokers to omnibus method.
Param | Description |
---|---|
parameter |
Type of the parameter |
parameter2 |
Type of the second parameter |
parameter3 |
Type of the third parameter |
Type | Description |
---|---|
MockedMethod | MockedMethod.Builder |
public MockedMethod withParameterTypes(System parameter, System parameter2, System parameter3, System parameter4)
SUPPRESSWARNINGS
Four parameter variant. Brokers to omnibus method.
Param | Description |
---|---|
parameter |
Type of the parameter |
parameter2 |
Type of the second parameter |
parameter3 |
Type of the third parameter |
parameter4 |
Type of the fourth parameter |
Type | Description |
---|---|
MockedMethod | MockedMethod.Builder |
Called at the end of building a method signature.
Type | Description |
---|---|
Stub | Stub.Builder |
Creates the MockedMethod matching this method signature.
Type | Description |
---|---|
List<MockedMethod> | List<MockedMethod> |