Case 2: If null, return an empty String
public void testIfNullReturnEmpty() {
assertEquals("If Null", "" , FormatDate.formatDate(null));
}
Case 3: If single M, append '0' and return in format MM-DD-YYYY
public void testSingleM() {
assertEquals("Single M", "01-11-2003", FormatDate.formatDate("1-11-2003"));
}
Case 4: If single D, append '0' and return in format MM-DD-YYYY
public void testSingleD() {
assertEquals("Single D","11-01-2003", FormatDate.formatDate("11-01-2003"));
}
Case 5: If two Ys instead of four, append '20' and return in format MM-DD-YYYY
public void testDoubleY() {
assertEquals("11-11-2003", FormatDate.formatDate("11-11-03"));
}
Case 6: If valid input in format MM-DD-YYYY, return as MM-DD-YYYY
public void testValid() {
assertEquals("Valid Case","11-11-2003", FormatDate.formatDate("11-11-2003"));
}