use of org.apache.sling.validation.impl.validators.RegexValidator in project sling by apache.
the class ValidationServiceImplTest method setUp.
@Before
public void setUp() throws LoginException, PersistenceException, RepositoryException {
validationService = new ValidationServiceImpl();
validationService.searchPaths = Arrays.asList(context.resourceResolver().getSearchPath());
validationService.configuration = configuration;
Mockito.doReturn(20).when(configuration).defaultSeverity();
validationService.resourceBundleProviders = Collections.singletonList(resourceBundleProvider);
Mockito.doReturn(defaultResourceBundle).when(resourceBundleProvider).getResourceBundle(Mockito.anyObject());
modelBuilder = new ValidationModelBuilder();
propertyBuilder = new ResourcePropertyBuilder();
dateValidator = new DateValidator();
Mockito.doReturn(1l).when(providingBundle).getBundleId();
Mockito.doReturn(providingBundle).when(validatorServiceReference).getBundle();
Mockito.doReturn(providingBundle).when(newValidatorServiceReference).getBundle();
validationService.validatorMap.put(DATE_VALIDATOR_ID, dateValidator, validatorServiceReference, 10);
validationService.validatorMap.put(REGEX_VALIDATOR_ID, new RegexValidator(), validatorServiceReference, 10);
validationService.modelRetriever = modelRetriever;
}
use of org.apache.sling.validation.impl.validators.RegexValidator in project sling by apache.
the class ValidatorTypeUtilTest method testGetValidatorTypeOfDirectImplementations.
@SuppressWarnings("unchecked")
@Test
public void testGetValidatorTypeOfDirectImplementations() {
Assert.assertThat((Class<String>) ValidatorTypeUtil.getValidatorType(new RegexValidator()), Matchers.equalTo(String.class));
Assert.assertThat((Class<String>) ValidatorTypeUtil.getValidatorType(new StringValidator()), Matchers.equalTo(String.class));
Assert.assertThat((Class<Integer>) ValidatorTypeUtil.getValidatorType(new IntegerValidator()), Matchers.equalTo(Integer.class));
}
Aggregations