javatestingacceptance

Gregorian Calendar - Document based testing


After doing JUnit i am doing some document based testing that has the following items in a table

Input Variables - Expected Outcome - Actual Outcome ..... Pass or Fail ....

If i pass my method a date and a time

"01AUG07" "14:40" the method should return me a gregorian calander which it does

how can i check that it has created the correct one?

thanks

unsure which to pick as the best becuase i dont no which is - i used miks and it worked.

thanks guys


Solution

  • Create a GregorianCalendar with the expect value and compare them. I'd use SimpleDateFormat and the setTime method.

    GregorianCalendar expected = new GregorianCalendar();
    expected.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm").parse("2007-08-01 14:40"));
    
    SystemUnderTest subject = SystemUnderTest();
    
    assertEquals(expected, subject.method());