### Question:
MethodsViaProxy implements Methods<T> { @Override public Method<T> get(Consumer<T> consumer) { return getMethod(consumer); } MethodsViaProxy(Class<T> type, ProxyBuilder<T> proxyBuilder); @Override Method<T> get(Consumer<T> consumer); @Override Method<T> get(BiConsumer<T, P> biConsumer); @Override Method<T> get(TriConsumer<T, P1, P2> triConsumer); @Override Method<T> get(QuadConsumer<T, P1, P2, P3> quadConsumer); @Override Method<T> get(Function<T, R> function); @Override Method<T> get(BiFunction<T, P, R> biFunction); @Override Method<T> get(TriFunction<T, P1, P2, R> triFunction); @Override Method<T> get(QuadFunction<T, P1, P2, P3, R> quadFunction);  }### Answer:
@Test public void testInterface() { final MethodsViaProxy<I> methods = new MethodsViaProxy<I>(I.class, new NativeProxyBuilder<>()); assertEquals("m1", methods.get(I::m1).name()); assertEquals("m2", methods.get(I::m2).name()); assertEquals("m3", methods.get(I::m3).name()); assertEquals("m4", methods.get(I::m4).name()); assertEquals("m5", methods.get(I::m5).name()); assertEquals("m6", methods.get(I::m6).name()); final BiConsumer<I, Boolean> m7 = I::m7; assertEquals("m7", methods.get(m7).name()); }
@Test public void testClass() { final MethodsViaProxy<C> methods = new MethodsViaProxy<>(C.class, new ByteBuddyProxyBuilder<>()); assertEquals("m1", methods.get(C::m1).name()); assertEquals("m2", methods.get(C::m2).name()); assertEquals("m3", methods.get(C::m3).name()); assertEquals("m4", methods.get(C::m4).name()); assertEquals("m5", methods.get(C::m5).name()); assertEquals("m6", methods.get(C::m6).name()); final BiConsumer<C, Boolean> m7 = C::m7; assertEquals("m7", methods.get(m7).name()); }