### Question:
Utils { public static <T, S extends BaseConfig> IExtractor<T, S> getExtractorInstance(S config) { try { Class<T> rdd = (Class<T>) config.getExtractorImplClass(); if (rdd == null) { rdd = (Class<T>) Class.forName(config.getExtractorImplClassName()); } Constructor<T> c; if (config.getEntityClass().isAssignableFrom(Cells.class)) { c = rdd.getConstructor(); return (IExtractor<T, S>) c.newInstance(); } else { c = rdd.getConstructor(Class.class); return (IExtractor<T, S>) c.newInstance(config.getEntityClass()); } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { String message = "A exception happens and we wrap with DeepExtractorInitializationException" + e.getMessage(); LOG.error(message); throw new DeepExtractorInitializationException(message,e); } } private  Utils(); static T newTypeInstance(Class<T> clazz); @SuppressWarnings("unchecked") static T newTypeInstance(String className, Class<T> returnClass); static String quote(String identifier); static String singleQuote(String identifier); static String batchQueryGenerator(List<String> statements); static Tuple2<String[], Object[]> prepareTuple4CqlDriver(Tuple2<Cells, Cells> tuple); @SuppressWarnings("unchecked") static Method findSetter(String propertyName, Class entityClass, Class valueType); static boolean setFieldWithReflection(Object object, String fieldName, Object fieldValue); @SuppressWarnings("unchecked") static Method findGetter(String propertyName, Class entityClass); static InetAddress inetAddressFromLocation(String location); static Field[] getAllFields(Class clazz); static List<String> removeAddressPort(List<String> stringList); static String splitListByComma(List<String> hosts); static IExtractor<T, S> getExtractorInstance(S config); static Object castNumberType(Object object, Class clazz); static Object castingUtil(String value, Class classCasting); static W initConfig(S config, W deepJobConfig); static T cloneObjectWithParents(T t); static ExecutorService newBlockingFixedThreadPoolExecutor(int nThreads, int queueSize);  }### Answer:
@Test public void testGetExtractorInstance() throws Exception { BaseConfig<Cells, BaseConfig> baseConfig = new BaseConfig<>(); baseConfig.setEntityClass(Cells.class); baseConfig.setExtractorImplClass(testExtractor.class); IExtractor extractorInstance1 = getExtractorInstance(baseConfig); assertNotNull(extractorInstance1); }