test/org/ohmage/validator/DocumentValidatorsTest.java
@Test
	public void testValidateDocumentId() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(DocumentValidators.validateDocumentId(emptyValue));
			}
			
			try {
				DocumentValidators.validateDocumentId("Invalid value.");
				fail("The document ID was invalid.");
			}
			catch(ValidationException e) {
				// Passed.
			}
			
			UUID uuid = UUID.randomUUID();
			try {
				DocumentValidators.validateDocumentId(uuid.toString());
			}
			catch(ValidationException e) {
				fail("A randomly-generated, yet valid, UUID '" + uuid.toString() + "' was rejected: " + e.getMessage());
			}
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
/**
	 * Tests the document ID validator.
	 */
Tests the document ID validator.
Tests the document ID validator .
@Test
	public void testValidateDocumentId() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(DocumentValidators.validateDocumentId(emptyValue));
			}
			try {
				DocumentValidators.validateDocumentId("Invalid value.");
				fail("The document ID was invalid.");
			}
			catch(ValidationException e) {
			}
			UUID uuid = UUID.randomUUID();
			try {
				DocumentValidators.validateDocumentId(uuid.toString());
			}
			catch(ValidationException e) {
				fail("A randomly-generated, yet valid, UUID '" + uuid.toString() + "' was rejected: " + e.getMessage());
			}
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
@ Test public void testValidateDocumentId ( ) { try { for ( String emptyValue : ParameterSets . getEmptyValues ( ) ) { Assert . assertNull ( DocumentValidators . validateDocumentId ( emptyValue ) ) ; } try { DocumentValidators . validateDocumentId ( "Invalid value." ) ; fail ( "The document ID was invalid." ) ; } catch ( ValidationException e ) { } UUID uuid = UUID . randomUUID ( ) ; try { DocumentValidators . validateDocumentId ( uuid . toString ( ) ) ; } catch ( ValidationException e ) { fail ( "A randomly-generated, yet valid, UUID '" + uuid . toString ( ) + "' was rejected: " + e . getMessage ( ) ) ; } } catch ( ValidationException e ) { fail ( "A validation exception was thrown: " + e . getMessage ( ) ) ; } }
Tests the document ID validator.
Tests the document ID validator .
// Passed.