### Question:
LambdaInvocationHandler implements InvocationHandler { Object processInvokeResult(Method method, InvokeResult invokeResult) throws IOException { if (invokeResult.getLogResult() != null) { LOGGER.debug(method.getName() + " log: " + new String(Base64.decode(invokeResult.getLogResult()), StringUtils.UTF8)); } if (invokeResult.getFunctionError() != null) { throw new LambdaFunctionException(invokeResult.getFunctionError(), new String(invokeResult.getPayload().array(), StringUtils.UTF8)); } if (invokeResult.getStatusCode() == HttpURLConnection.HTTP_NO_CONTENT || void.class.equals(method.getReturnType())) { return null; } return binder.deserialize(invokeResult.getPayload().array(), method.getReturnType()); } LambdaInvocationHandler(AWSLambda lambda, LambdaDataBinder binder,
            ClientContext clientContext); @Override Object invoke(Object proxy, Method method, Object[] args);  }### Answer:
@Test public void testProcessInvokeResult() throws Exception { Method echo = getMethod("echo", String.class); InvokeResult invokeResult = createInvokeResult(200, null, "\"hello world\""); String result = (String) handler.processInvokeResult(echo, invokeResult); assertEquals("same result", "hello world", result); }
@Test public void testProcessInvokeResult204() throws Exception { Method echo = getMethod("echo", String.class); InvokeResult invokeResult = createInvokeResult(204, null, null); invokeResult.setStatusCode(204); invokeResult.setFunctionError(null); invokeResult.setPayload(null); String result = (String) handler.processInvokeResult(echo, invokeResult); assertNull("no content", result); }
@Test(expected = LambdaFunctionException.class) public void testException() throws Exception { Method echo = getMethod("echo", String.class); String error = "Panic!"; String payload = "Bulls eye"; InvokeResult invokeResult = createInvokeResult(200, error, payload); try { handler.processInvokeResult(echo, invokeResult); } catch (LambdaFunctionException lfe) { assertEquals("error message", error, lfe.getMessage()); assertEquals("payload", payload, lfe.getDetails()); throw lfe; } }