@@ -0,0 +1,2272 @@
+package org.dynalang.dynalink.beans;%0A%0Aimport java.lang.invoke.MethodHandle;%0Aimport java.lang.invoke.MethodHandles;%0Aimport java.lang.invoke.MethodType;%0A%0Aimport junit.framework.TestCase;%0A%0Aimport org.dynalang.dynalink.DynamicLinker;%0Aimport org.dynalang.dynalink.DynamicLinkerFactory;%0Aimport org.dynalang.dynalink.MonomorphicCallSite;%0Aimport org.dynalang.dynalink.linker.CallSiteDescriptor;%0A%0Apublic class TestNew extends TestCase %7B%0A    private static final DynamicLinker linker = new DynamicLinkerFactory().createLinker();%0A%0A    public void testAll() throws Throwable %7B%0A        test(%22a%22, %22b%22, %22String,String%22, ctor(%22a%22, %22b%22));%0A        test(%22a%22, null, %22String%22, ctor(%22a%22));%0A        test(%22a%22, %221f%22, %22String,int%22, ctor(%22a%22, 31));%0A    %7D%0A%0A    private static void test(String foo, String bar, String ctor, T1 obj) %7B%0A        assertEquals(foo, obj.foo);%0A        assertEquals(bar, obj.bar);%0A        assertEquals(ctor, obj.ctor);%0A    %7D%0A%0A    private static T1 ctor(Object arg1) throws Throwable %7B%0A        return T1.class.cast(getInvoker(%22dyn:new%22, T1.class, Class.class, Object.class).invoke(T1.class, arg1));%0A    %7D%0A%0A    private static T1 ctor(Object arg1, Object arg2) throws Throwable %7B%0A        return T1.class.cast(getInvoker(%22dyn:new%22, T1.class, Class.class, Object.class, Object.class).invoke(T1.class,%0A                arg1, arg2));%0A    %7D%0A%0A    private static MethodHandle getInvoker(String name, Class%3C?%3E retType, Class%3C?%3E... paramTypes) %7B%0A        final MonomorphicCallSite cs = new MonomorphicCallSite(CallSiteDescriptor.create(MethodHandles.publicLookup(),%0A                name, MethodType.methodType(retType, paramTypes)));%0A        linker.link(cs);%0A        return cs.dynamicInvoker();%0A    %7D%0A%0A    public static class T1 %7B%0A        public final String foo;%0A        public final String bar;%0A        public final String ctor;%0A%0A        public T1(String foo, String bar, String ctor) %7B%0A            this.foo = foo;%0A            this.bar = bar;%0A            this.ctor = ctor;%0A        %7D%0A%0A        public T1(String foo, String bar) %7B%0A            this(foo, bar, %22String,String%22);%0A        %7D%0A%0A        public T1(String foo, int bar) %7B%0A            this(foo, Integer.toHexString(bar), %22String,int%22);%0A        %7D%0A%0A        public T1(String foo) %7B%0A            this(foo, null, %22String%22);%0A        %7D%0A    %7D%0A%7D%0A

Add test for constructors