test/org/ohmage/validator/DateValidatorsTest.java
@Test
	public void testValidateISO8601DateTime() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(DateValidators.validateISO8601DateTime(emptyValue));
			}
			
			try {
				DateValidators.validateISO8601DateTime("Invalid value.");
				fail("The date-time was invalid.");
			}
			catch(ValidationException e) {
				// Passed.
			}
			
			Map<DateTime, String> dateTimeToStringMap = ParameterSets.getDateTimeToString();
			for(DateTime date : dateTimeToStringMap.keySet()) {
				Assert.assertEquals(date, DateValidators.validateISO8601DateTime(dateTimeToStringMap.get(date)));
			}
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
/**
	 * Tests the date-time validator.
	 */
Tests the date-time validator.
Tests the date - time validator .
@Test
	public void testValidateISO8601DateTime() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(DateValidators.validateISO8601DateTime(emptyValue));
			}
			try {
				DateValidators.validateISO8601DateTime("Invalid value.");
				fail("The date-time was invalid.");
			}
			catch(ValidationException e) {
			}
			Map<DateTime, String> dateTimeToStringMap = ParameterSets.getDateTimeToString();
			for(DateTime date : dateTimeToStringMap.keySet()) {
				Assert.assertEquals(date, DateValidators.validateISO8601DateTime(dateTimeToStringMap.get(date)));
			}
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
@ Test public void testValidateISO8601DateTime ( ) { try { for ( String emptyValue : ParameterSets . getEmptyValues ( ) ) { Assert . assertNull ( DateValidators . validateISO8601DateTime ( emptyValue ) ) ; } try { DateValidators . validateISO8601DateTime ( "Invalid value." ) ; fail ( "The date-time was invalid." ) ; } catch ( ValidationException e ) { } Map < DateTime , String > dateTimeToStringMap = ParameterSets . getDateTimeToString ( ) ; for ( DateTime date : dateTimeToStringMap . keySet ( ) ) { Assert . assertEquals ( date , DateValidators . validateISO8601DateTime ( dateTimeToStringMap . get ( date ) ) ) ; } } catch ( ValidationException e ) { fail ( "A validation exception was thrown: " + e . getMessage ( ) ) ; } }
Tests the date-time validator.
Tests the date - time validator .
// Passed.