@Test public void testByArgumentTypes() throws ScriptException { DefaultConstructorStrategy constructorStrategy = DefaultConstructorStrategy.byArgumentTypes( new Class<?>[] { String.class, int.class }, "Hello", 42); TestConstructor constructed = (TestConstructor) constructorStrategy.construct(TestConstructor.class); assertThat(constructed.message).isEqualTo("TestConstructor(Hello,42)"); }
public static DefaultConstructorStrategy byArgumentTypes(Class<?>[] argumentTypes, Object... arguments) { return new DefaultConstructorStrategy(argumentTypes, arguments); }
DefaultConstructorStrategy implements ConstructorStrategy { public static DefaultConstructorStrategy byArgumentTypes(Class<?>[] argumentTypes, Object... arguments) { return new DefaultConstructorStrategy(argumentTypes, arguments); } }
DefaultConstructorStrategy implements ConstructorStrategy { public static DefaultConstructorStrategy byArgumentTypes(Class<?>[] argumentTypes, Object... arguments) { return new DefaultConstructorStrategy(argumentTypes, arguments); } private  DefaultConstructorStrategy(Class<?>[] argumentTypes, Object[] arguments); }
DefaultConstructorStrategy implements ConstructorStrategy { public static DefaultConstructorStrategy byArgumentTypes(Class<?>[] argumentTypes, Object... arguments) { return new DefaultConstructorStrategy(argumentTypes, arguments); } private  DefaultConstructorStrategy(Class<?>[] argumentTypes, Object[] arguments); @Override Object construct(Class<?> clazz); static DefaultConstructorStrategy byDefaultConstructor(); static DefaultConstructorStrategy byArgumentTypes(Class<?>[] argumentTypes, Object... arguments); static DefaultConstructorStrategy byMatchingArguments(Object... arguments); }
DefaultConstructorStrategy implements ConstructorStrategy { public static DefaultConstructorStrategy byArgumentTypes(Class<?>[] argumentTypes, Object... arguments) { return new DefaultConstructorStrategy(argumentTypes, arguments); } private  DefaultConstructorStrategy(Class<?>[] argumentTypes, Object[] arguments); @Override Object construct(Class<?> clazz); static DefaultConstructorStrategy byDefaultConstructor(); static DefaultConstructorStrategy byArgumentTypes(Class<?>[] argumentTypes, Object... arguments); static DefaultConstructorStrategy byMatchingArguments(Object... arguments);  }