use of org.olat.user.propertyhandlers.PhonePropertyHandler in project OpenOLAT by OpenOLAT.
the class UserPropertiesTest method testPhonePropertyHandlerValidation.
@Test
public void testPhonePropertyHandlerValidation() {
PhonePropertyHandler phoneHandler = new PhonePropertyHandler();
ValidationError error = new ValidationError();
// test for valid phone number formats
assertTrue(phoneHandler.isValidValue(null, "043 544 90 00", error, null));
assertTrue(phoneHandler.isValidValue(null, "043/544'90'00", error, null));
assertTrue(phoneHandler.isValidValue(null, "043/544'90'00", error, null));
assertTrue(phoneHandler.isValidValue(null, "043-544-90-00", error, null));
assertTrue(phoneHandler.isValidValue(null, "043.544.90.00", error, null));
assertTrue(phoneHandler.isValidValue(null, "+41 43 544 90 00", error, null));
assertTrue(phoneHandler.isValidValue(null, "+41 (0)43 544 90 00", error, null));
assertTrue(phoneHandler.isValidValue(null, "+41 43 544 90 00 x0", error, null));
assertTrue(phoneHandler.isValidValue(null, "+41 43 544 90 00 ext. 0", error, null));
assertTrue(phoneHandler.isValidValue(null, "+41 43 544 90 00 ext0", error, null));
assertTrue(phoneHandler.isValidValue(null, "+41 43 544 90 00 ext 0", error, null));
assertTrue(phoneHandler.isValidValue(null, "+41 43 544 90 00 extension 0", error, null));
assertTrue(phoneHandler.isValidValue(null, "+41 43 544 90 00 Extension 0", error, null));
// test for invalid phone number formats
assertFalse(phoneHandler.isValidValue(null, "+41 43 frentix GmbH", error, null));
}
use of org.olat.user.propertyhandlers.PhonePropertyHandler in project openolat by klemens.
the class UserPropertiesTest method testPhonePropertyHandlerValidation.
@Test
public void testPhonePropertyHandlerValidation() {
PhonePropertyHandler phoneHandler = new PhonePropertyHandler();
ValidationError error = new ValidationError();
// test for valid phone number formats
assertTrue(phoneHandler.isValidValue(null, "043 544 90 00", error, null));
assertTrue(phoneHandler.isValidValue(null, "043/544'90'00", error, null));
assertTrue(phoneHandler.isValidValue(null, "043/544'90'00", error, null));
assertTrue(phoneHandler.isValidValue(null, "043-544-90-00", error, null));
assertTrue(phoneHandler.isValidValue(null, "043.544.90.00", error, null));
assertTrue(phoneHandler.isValidValue(null, "+41 43 544 90 00", error, null));
assertTrue(phoneHandler.isValidValue(null, "+41 (0)43 544 90 00", error, null));
assertTrue(phoneHandler.isValidValue(null, "+41 43 544 90 00 x0", error, null));
assertTrue(phoneHandler.isValidValue(null, "+41 43 544 90 00 ext. 0", error, null));
assertTrue(phoneHandler.isValidValue(null, "+41 43 544 90 00 ext0", error, null));
assertTrue(phoneHandler.isValidValue(null, "+41 43 544 90 00 ext 0", error, null));
assertTrue(phoneHandler.isValidValue(null, "+41 43 544 90 00 extension 0", error, null));
assertTrue(phoneHandler.isValidValue(null, "+41 43 544 90 00 Extension 0", error, null));
// test for invalid phone number formats
assertFalse(phoneHandler.isValidValue(null, "+41 43 frentix GmbH", error, null));
}
Aggregations