### Question:
InvokeDynamic implements Implementation.Composable { public static WithImplicitArguments lambda(Method method, Class<?> functionalInterface) { return lambda(new MethodDescription.ForLoadedMethod(method), TypeDescription.ForLoadedType.of(functionalInterface)); } protected  InvokeDynamic(MethodDescription.InDefinedShape bootstrap,
                            List<?> arguments,
                            InvocationProvider invocationProvider,
                            TerminationHandler terminationHandler,
                            Assigner assigner,
                            Assigner.Typing typing); static WithImplicitTarget bootstrap(Method method, Object... constant); static WithImplicitTarget bootstrap(Method method, List<?> constants); static WithImplicitTarget bootstrap(Constructor<?> constructor, Object... constant); static WithImplicitTarget bootstrap(Constructor<?> constructor, List<?> constants); static WithImplicitTarget bootstrap(MethodDescription.InDefinedShape bootstrap, Object... constant); static WithImplicitTarget bootstrap(MethodDescription.InDefinedShape bootstrap, List<?> constants); static WithImplicitArguments lambda(Method method, Class<?> functionalInterface); static WithImplicitArguments lambda(Method method, Class<?> functionalInterface, MethodGraph.Compiler methodGraphCompiler); static WithImplicitArguments lambda(MethodDescription.InDefinedShape methodDescription, TypeDescription functionalInterface); static WithImplicitArguments lambda(MethodDescription.InDefinedShape methodDescription,
                                               TypeDescription functionalInterface,
                                               MethodGraph.Compiler methodGraphCompiler); InvokeDynamic withBooleanValue(boolean... value); InvokeDynamic withByteValue(byte... value); InvokeDynamic withShortValue(short... value); InvokeDynamic withCharacterValue(char... value); InvokeDynamic withIntegerValue(int... value); InvokeDynamic withLongValue(long... value); InvokeDynamic withFloatValue(float... value); InvokeDynamic withDoubleValue(double... value); InvokeDynamic withValue(Object... value); WithImplicitType withReference(Object value); InvokeDynamic withReference(Object... value); InvokeDynamic withType(TypeDescription... typeDescription); InvokeDynamic withEnumeration(EnumerationDescription... enumerationDescription); InvokeDynamic withInstance(JavaConstant... javaConstant); InvokeDynamic withNullValue(Class<?>... type); InvokeDynamic withNullValue(TypeDescription... typeDescription); InvokeDynamic withArgument(int... index); WithImplicitType withArgument(int index); InvokeDynamic withThis(Class<?>... type); InvokeDynamic withThis(TypeDescription... typeDescription); InvokeDynamic withMethodArguments(); InvokeDynamic withImplicitAndMethodArguments(); InvokeDynamic withField(String... name); InvokeDynamic withField(FieldLocator.Factory fieldLocatorFactory, String... name); WithImplicitType withField(String name); WithImplicitType withField(String name, FieldLocator.Factory fieldLocatorFactory); Implementation.Composable withAssigner(Assigner assigner, Assigner.Typing typing); Implementation andThen(Implementation implementation); Composable andThen(Composable implementation); InstrumentedType prepare(InstrumentedType instrumentedType); ByteCodeAppender appender(Target implementationTarget);  }### Answer:
@Test @JavaVersionRule.Enforce(8) public void testLambdaMetaFactory() throws Exception { DynamicType.Loaded<FunctionalFactory> dynamicType = new ByteBuddy() .subclass(FunctionalFactory.class) .method(isDeclaredBy(FunctionalFactory.class)) .intercept(InvokeDynamic.lambda(InvokeDynamicTest.class.getMethod("value"), Callable.class)) .make() .load(getClass().getClassLoader(), ClassLoadingStrategy.Default.WRAPPER); assertThat(dynamicType.getLoaded().getDeclaredFields().length, is(0)); assertThat(dynamicType.getLoaded().getDeclaredConstructor().newInstance().make().call(), is(FOO)); }
@Test(expected = IllegalArgumentException.class) public void testLambdaMetaFactoryNoInterface() throws Exception { InvokeDynamic.lambda(InvokeDynamicTest.class.getMethod("value"), Object.class); }
@Test(expected = IllegalArgumentException.class) public void testLambdaMetaFactoryNoFunctionalInterface() throws Exception { InvokeDynamic.lambda(InvokeDynamicTest.class.getMethod("value"), ExecutorService.class); }