test/org/ohmage/validator/UserValidatorsTest.java
@Test
	public void testValidatePersonalId() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(UserValidators.validatePersonalId(emptyValue));
			}
			
			StringBuilder nameBuilder = new StringBuilder();
			for(int i = 0; i < UserValidators.MAX_PERSONAL_ID_LENGTH; i++) {
				nameBuilder.append('a');
			}
			nameBuilder.append('a');
			
			try {
				UserValidators.validatePersonalId(nameBuilder.toString());
				fail("An organization that was too long passed validation");
			}
			catch(ValidationException e) {
				// Passed.
			}
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
/**
	 * Tests the personal ID value validator.
	 */
Tests the personal ID value validator.
Tests the personal ID value validator .
@Test
	public void testValidatePersonalId() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(UserValidators.validatePersonalId(emptyValue));
			}
			StringBuilder nameBuilder = new StringBuilder();
			for(int i = 0; i < UserValidators.MAX_PERSONAL_ID_LENGTH; i++) {
				nameBuilder.append('a');
			}
			nameBuilder.append('a');
			try {
				UserValidators.validatePersonalId(nameBuilder.toString());
				fail("An organization that was too long passed validation");
			}
			catch(ValidationException e) {
			}
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
@ Test public void testValidatePersonalId ( ) { try { for ( String emptyValue : ParameterSets . getEmptyValues ( ) ) { Assert . assertNull ( UserValidators . validatePersonalId ( emptyValue ) ) ; } StringBuilder nameBuilder = new StringBuilder ( ) ; for ( int i = 0 ; i < UserValidators . MAX_PERSONAL_ID_LENGTH ; i ++ ) { nameBuilder . append ( 'a' ) ; } nameBuilder . append ( 'a' ) ; try { UserValidators . validatePersonalId ( nameBuilder . toString ( ) ) ; fail ( "An organization that was too long passed validation" ) ; } catch ( ValidationException e ) { } } catch ( ValidationException e ) { fail ( "A validation exception was thrown: " + e . getMessage ( ) ) ; } }
Tests the personal ID value validator.
Tests the personal ID value validator .
// Passed.