daily pastebin goal
32%
SHARE
TWEET

Untitled

a guest Dec 18th, 2018 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class MockUtil {
  2.     private MockUtil(){}
  3.  
  4.      public static Object createMock(Type typeToMock) {
  5.         return Test.createStub(typeToMock, Type.forName('MockUtil.' + typeToMock.getName() + 'Mock').getInstance());
  6.     }
  7.    
  8.     //All inner classes uses the same name format <class name they are mocking>Mock
  9.     public class ClassName1Mock implements System.StubProvider {
  10.       public Object handleMethodCall(Object stubbedObject, String stubbedMethodName,
  11.         Type returnType, List<Type> listOfParamTypes, List<String> listOfParamNames,
  12.         List<Object> listOfArgs) {
  13.           ...
  14.         }
  15.     }
  16.    
  17.     public class ClassName2Mock implements System.StubProvider {
  18.       public Object handleMethodCall(Object stubbedObject, String stubbedMethodName,
  19.         Type returnType, List<Type> listOfParamTypes, List<String> listOfParamNames,
  20.         List<Object> listOfArgs) {
  21.           ...
  22.         }
  23.     }
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top