@Test public void testOrderOfValidators() throws ParserConfigurationException, SAXException { ValidationExecutor executor = executorFactory.createValidationExecutor(context, true, true, validatorsSettings); if (executor == null) { throw new IllegalStateException("Could not create validation executor!"); } Map<String, Validator> actualValidators = executor.getAllValidatorsById(); Map<String, Validator> expectedValidators = new LinkedHashMap<>(); expectedValidators.put("id1", validator1); expectedValidators.put("id2", validator2); expectedValidators.put("id3", validator3); Assert.assertEquals(expectedValidators.toString(), actualValidators.toString()); Assert.assertThat(actualValidators.keySet(), Matchers.contains("id1", "id2", "id3")); Collections.shuffle(validatorFactories); executorFactory = new ValidationExecutorFactory(validatorFactories); executor = executorFactory.createValidationExecutor(context, true, true, validatorsSettings); if (executor == null) { throw new IllegalStateException("Could not create validation executor!"); } actualValidators = executor.getAllValidatorsById(); Assert.assertEquals(expectedValidators.toString(), actualValidators.toString()); Assert.assertThat(actualValidators.keySet(), Matchers.contains("id1", "id2", "id3")); }
public @Nullable ValidationExecutor createValidationExecutor(@NotNull ValidationContext context, boolean isSubPackage, boolean enforceSubpackageValidation, Map<String, ? extends ValidatorSettings> validatorSettingsById) { Map<String, Validator> validatorsById = createValidators(context, isSubPackage, enforceSubpackageValidation, validatorSettingsById != null ? validatorSettingsById : Collections.emptyMap()); if (validatorsById.isEmpty()) { return null; } return new ValidationExecutor(validatorsById); }
ValidationExecutorFactory { public @Nullable ValidationExecutor createValidationExecutor(@NotNull ValidationContext context, boolean isSubPackage, boolean enforceSubpackageValidation, Map<String, ? extends ValidatorSettings> validatorSettingsById) { Map<String, Validator> validatorsById = createValidators(context, isSubPackage, enforceSubpackageValidation, validatorSettingsById != null ? validatorSettingsById : Collections.emptyMap()); if (validatorsById.isEmpty()) { return null; } return new ValidationExecutor(validatorsById); } }
ValidationExecutorFactory { public @Nullable ValidationExecutor createValidationExecutor(@NotNull ValidationContext context, boolean isSubPackage, boolean enforceSubpackageValidation, Map<String, ? extends ValidatorSettings> validatorSettingsById) { Map<String, Validator> validatorsById = createValidators(context, isSubPackage, enforceSubpackageValidation, validatorSettingsById != null ? validatorSettingsById : Collections.emptyMap()); if (validatorsById.isEmpty()) { return null; } return new ValidationExecutor(validatorsById); } ValidationExecutorFactory(ClassLoader classLoader);   ValidationExecutorFactory(Iterable<ValidatorFactory> validatorFactoriesUnsorted); }
ValidationExecutorFactory { public @Nullable ValidationExecutor createValidationExecutor(@NotNull ValidationContext context, boolean isSubPackage, boolean enforceSubpackageValidation, Map<String, ? extends ValidatorSettings> validatorSettingsById) { Map<String, Validator> validatorsById = createValidators(context, isSubPackage, enforceSubpackageValidation, validatorSettingsById != null ? validatorSettingsById : Collections.emptyMap()); if (validatorsById.isEmpty()) { return null; } return new ValidationExecutor(validatorsById); } ValidationExecutorFactory(ClassLoader classLoader);   ValidationExecutorFactory(Iterable<ValidatorFactory> validatorFactoriesUnsorted); @Nullable ValidationExecutor createValidationExecutor(@NotNull ValidationContext context, boolean isSubPackage, boolean enforceSubpackageValidation, Map<String, ? extends ValidatorSettings> validatorSettingsById); }
ValidationExecutorFactory { public @Nullable ValidationExecutor createValidationExecutor(@NotNull ValidationContext context, boolean isSubPackage, boolean enforceSubpackageValidation, Map<String, ? extends ValidatorSettings> validatorSettingsById) { Map<String, Validator> validatorsById = createValidators(context, isSubPackage, enforceSubpackageValidation, validatorSettingsById != null ? validatorSettingsById : Collections.emptyMap()); if (validatorsById.isEmpty()) { return null; } return new ValidationExecutor(validatorsById); } ValidationExecutorFactory(ClassLoader classLoader);   ValidationExecutorFactory(Iterable<ValidatorFactory> validatorFactoriesUnsorted); @Nullable ValidationExecutor createValidationExecutor(@NotNull ValidationContext context, boolean isSubPackage, boolean enforceSubpackageValidation, Map<String, ? extends ValidatorSettings> validatorSettingsById);  }