@Test
public void testOrderOfValidators() throws ParserConfigurationException, SAXException {

    // first validate order
    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"));
    // the reinstantiate with a different order
    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();
    // the returned validators should still have the same order
    Assert.assertEquals(expectedValidators.toString(), actualValidators.toString());
    Assert.assertThat(actualValidators.keySet(), Matchers.contains("id1", "id2", "id3"));
}