test/org/ohmage/validator/CampaignValidatorsTest.java
@Test
	public void testValidateStartDate() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(CampaignValidators.validateStartDate(emptyValue));
			}
			
			try {
				CampaignValidators.validateStartDate("Invalid value.");
				fail("The campaign start date was an invalid value.");
			}
			catch(ValidationException e) { 
				// Passed.
			}

			Map<DateTime, String> dateToString = ParameterSets.getDateToString();
			for(DateTime date : dateToString.keySet()) {
				Assert.assertEquals(date, CampaignValidators.validateStartDate(dateToString.get(date)));
			}
			
			Map<DateTime, String> dateTimeToString = ParameterSets.getDateTimeToString();
			for(DateTime date : dateTimeToString.keySet()) {
				Assert.assertEquals(date, CampaignValidators.validateStartDate(dateTimeToString.get(date)));
			}
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
/**
	 * Test the start date validator.
	 */
Test the start date validator.
Test the start date validator .
@Test
	public void testValidateStartDate() {
		try {
			for(String emptyValue : ParameterSets.getEmptyValues()) {
				Assert.assertNull(CampaignValidators.validateStartDate(emptyValue));
			}
			try {
				CampaignValidators.validateStartDate("Invalid value.");
				fail("The campaign start date was an invalid value.");
			}
			catch(ValidationException e) { 
			}
			Map<DateTime, String> dateToString = ParameterSets.getDateToString();
			for(DateTime date : dateToString.keySet()) {
				Assert.assertEquals(date, CampaignValidators.validateStartDate(dateToString.get(date)));
			}
			Map<DateTime, String> dateTimeToString = ParameterSets.getDateTimeToString();
			for(DateTime date : dateTimeToString.keySet()) {
				Assert.assertEquals(date, CampaignValidators.validateStartDate(dateTimeToString.get(date)));
			}
		}
		catch(ValidationException e) {
			fail("A validation exception was thrown: " + e.getMessage());
		}
	}
@ Test public void testValidateStartDate ( ) { try { for ( String emptyValue : ParameterSets . getEmptyValues ( ) ) { Assert . assertNull ( CampaignValidators . validateStartDate ( emptyValue ) ) ; } try { CampaignValidators . validateStartDate ( "Invalid value." ) ; fail ( "The campaign start date was an invalid value." ) ; } catch ( ValidationException e ) { } Map < DateTime , String > dateToString = ParameterSets . getDateToString ( ) ; for ( DateTime date : dateToString . keySet ( ) ) { Assert . assertEquals ( date , CampaignValidators . validateStartDate ( dateToString . get ( date ) ) ) ; } Map < DateTime , String > dateTimeToString = ParameterSets . getDateTimeToString ( ) ; for ( DateTime date : dateTimeToString . keySet ( ) ) { Assert . assertEquals ( date , CampaignValidators . validateStartDate ( dateTimeToString . get ( date ) ) ) ; } } catch ( ValidationException e ) { fail ( "A validation exception was thrown: " + e . getMessage ( ) ) ; } }
Test the start date validator.
Test the start date validator .
// Passed.