test/org/ohmage/validator/DocumentValidatorsTest.java
@Test
	public void testValidatePrivacyState() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(DocumentValidators.validatePrivacyState(emptyValue));
			}
			
			try {
				DocumentValidators.validatePrivacyState("Invalid value.");
				fail("The document privacy state was invalid.");
			}
			catch(ValidationException e) {
				// Passed.
			}
			
			for(Document.PrivacyState privacyState : Document.PrivacyState.values()) {
				Assert.assertEquals(privacyState, DocumentValidators.validatePrivacyState(privacyState.toString()));
			}
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
/**
	 * Tests the document privacy state validator.
	 */
Tests the document privacy state validator.
Tests the document privacy state validator .
@Test
	public void testValidatePrivacyState() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(DocumentValidators.validatePrivacyState(emptyValue));
			}
			try {
				DocumentValidators.validatePrivacyState("Invalid value.");
				fail("The document privacy state was invalid.");
			}
			catch(ValidationException e) {
			}
			for(Document.PrivacyState privacyState : Document.PrivacyState.values()) {
				Assert.assertEquals(privacyState, DocumentValidators.validatePrivacyState(privacyState.toString()));
			}
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
@ Test public void testValidatePrivacyState ( ) { try { for ( String emptyValue : ParameterSets . getEmptyValues ( ) ) { Assert . assertNull ( DocumentValidators . validatePrivacyState ( emptyValue ) ) ; } try { DocumentValidators . validatePrivacyState ( "Invalid value." ) ; fail ( "The document privacy state was invalid." ) ; } catch ( ValidationException e ) { } for ( Document . PrivacyState privacyState : Document . PrivacyState . values ( ) ) { Assert . assertEquals ( privacyState , DocumentValidators . validatePrivacyState ( privacyState . toString ( ) ) ) ; } } catch ( ValidationException e ) { fail ( "A validation exception was thrown: " + e . getMessage ( ) ) ; } }
Tests the document privacy state validator.
Tests the document privacy state validator .
// Passed.