CallBuilder { public static <T extends Builder> T newInstance(Function function, Class<T> callType) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, IllegalArgumentException, InstantiationException { Constructor<T> ctor = callType.getConstructor(Function.class); return ctor.newInstance(function); }  static T newInstance(Function function, Class<T> callType);  }
@Test void testAddressCallBuilder() throws Exception { Function function = getFunction(functionCode); Map<String, Object> result = CallBuilder.newInstance(function, CallBuilder.Address.class) .houseNumber(houseNumber).streetName(streetName).boroughName(boroughName).zipCode(zipCode).arguments(); assertEquals(functionCode, result.get(InputParam.GEOSUPPORT_FUNCTION_CODE)); assertEquals(houseNumber, result.get(InputParam.HOUSE_NUMBER)); assertEquals(streetName, result.get(InputParam.STREET_NAME)); assertEquals(boroughCode, result.get(InputParam.BOROUGH_CODE)); assertEquals(requiredArgValue, result.get(requiredArgKey)); }