### Question:
LambdaInvocationHandler implements InvocationHandler { void validateInterfaceMethod(Method method, Object[] args) { if (method.getAnnotation(LambdaFunction.class) == null) { throw new UnsupportedOperationException("No LambdaFunction annotation for method " + method.getName()); } if (args != null && args.length > 1) { throw new UnsupportedOperationException( "LambdaFunctions take either 0 or 1 arguments."); } } LambdaInvocationHandler(AWSLambda lambda, LambdaDataBinder binder,
            ClientContext clientContext); @Override Object invoke(Object proxy, Method method, Object[] args);  }### Answer:
@Test(expected = UnsupportedOperationException.class) public void testNoAnnotation() throws Exception { Method noAnnotation = getMethod("noAnnotation"); handler.validateInterfaceMethod(noAnnotation, null); }
@Test(expected = UnsupportedOperationException.class) public void testTwoArguments() throws Exception { Method twoArguments = getMethod("twoArguments", String.class, String.class); handler.validateInterfaceMethod(twoArguments, new Object[] { "a", "b" }); }
@Test(expected = UnsupportedOperationException.class) public void testVariableArguments() throws Exception { Method variableArguments = getMethod("variableArguments", String[].class); handler.validateInterfaceMethod(variableArguments, new Object[] { "a", "b" }); }
@Test public void testOneArgument() throws Exception { Method oneArgument = getMethod("oneArgument", String.class); handler.validateInterfaceMethod(oneArgument, new Object[] { "a" }); }