@Test void createValidator() throws RedPenException { Configuration conf = Configuration.builder().addValidatorConfig(new ValidatorConfiguration("SentenceLength")).build(); assertEquals(SentenceLengthValidator.class, ValidatorFactory.getInstance(conf.getValidatorConfigs().get(0), conf).getClass()); }
private static Validator createValidator(Class<? extends Validator> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException("Cannot create instance of " + clazz + " using default constructor"); } }
ValidatorFactory { private static Validator createValidator(Class<? extends Validator> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException("Cannot create instance of " + clazz + " using default constructor"); } } }
ValidatorFactory { private static Validator createValidator(Class<? extends Validator> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException("Cannot create instance of " + clazz + " using default constructor"); } }  }
ValidatorFactory { private static Validator createValidator(Class<? extends Validator> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException("Cannot create instance of " + clazz + " using default constructor"); } }  static List<ValidatorConfiguration> getConfigurations(String lang); static Validator getInstance(String validatorName); static Validator getInstance(ValidatorConfiguration config, Configuration globalConfig); }
ValidatorFactory { private static Validator createValidator(Class<? extends Validator> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException("Cannot create instance of " + clazz + " using default constructor"); } }  static List<ValidatorConfiguration> getConfigurations(String lang); static Validator getInstance(String validatorName); static Validator getInstance(ValidatorConfiguration config, Configuration globalConfig);  }