test/org/ohmage/validator/UserValidatorsTest.java
@Test
	public void testValidateAdminValue() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(UserValidators.validateAdminValue(emptyValue));
			}
			
			try {
				UserValidators.validateAdminValue("Invalid value.");
				fail("The admin value is invalid.");
			}
			catch(ValidationException e) {
				// Passed.
			}
			
			Assert.assertEquals(true, UserValidators.validateAdminValue("true"));
			Assert.assertEquals(false, UserValidators.validateAdminValue("false"));
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
/**
	 * Tests the admin valid validator.
	 */
Tests the admin valid validator.
Tests the admin valid validator .
@Test
	public void testValidateAdminValue() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(UserValidators.validateAdminValue(emptyValue));
			}
			try {
				UserValidators.validateAdminValue("Invalid value.");
				fail("The admin value is invalid.");
			}
			catch(ValidationException e) {
			}
			Assert.assertEquals(true, UserValidators.validateAdminValue("true"));
			Assert.assertEquals(false, UserValidators.validateAdminValue("false"));
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
@ Test public void testValidateAdminValue ( ) { try { for ( String emptyValue : ParameterSets . getEmptyValues ( ) ) { Assert . assertNull ( UserValidators . validateAdminValue ( emptyValue ) ) ; } try { UserValidators . validateAdminValue ( "Invalid value." ) ; fail ( "The admin value is invalid." ) ; } catch ( ValidationException e ) { } Assert . assertEquals ( true , UserValidators . validateAdminValue ( "true" ) ) ; Assert . assertEquals ( false , UserValidators . validateAdminValue ( "false" ) ) ; } catch ( ValidationException e ) { fail ( "A validation exception was thrown: " + e . getMessage ( ) ) ; } }
Tests the admin valid validator.
Tests the admin valid validator .
// Passed.