public object answer(fflib_InvocationOnMock invocation) { actualInvocation = invocation; string argument = (string)invocation.getArgument(1); System.assertNotEquals(null, argument, " the argument should have some value"); argument = argument.replace("Hi", "Bye"); return argument; }
public object answer(fflib_InvocationOnMock invocation) { actualInvocation = invocation; try { object noExistingObj = invocation.getArgument(-1); System.assert(false, "an exception was expected because the argument index cannot be negative"); } catch (fflib_ApexMocks.ApexMocksException exp) { string expectedMessage = "Invalid index, must be greater or equal to zero and less of 2."; string actualMessage = exp.getMessage(); System.assertEquals(expectedMessage, actualMessage, "the message return by the exception is not as expected"); } return null; }