@Test
public void testSetDateAndTime() {

    ISODate date = new ISODate();
    date.setDateAndTime("1976-06-03T01:02:03");
    assertEquals(false, date.isDateOnly());
    assertEquals(1976, date.getYears());
    assertEquals(6, date.getMonths());
    assertEquals(3, date.getDays());
    assertEquals(1, date.getHours());
    assertEquals(2, date.getMinutes());
    assertEquals(3, date.getSeconds());
    date = new ISODate();
    date.setDateAndTime("T01:02:03");
    assertEquals(false, date.isDateOnly());
    assertEquals(Calendar.getInstance().get(Calendar.YEAR), date.getYears());
    assertEquals(Calendar.getInstance().get(Calendar.MONTH) + 1, date.getMonths());
    assertEquals(Calendar.getInstance().get(Calendar.DAY_OF_MONTH), date.getDays());
    assertEquals(1, date.getHours());
    assertEquals(2, date.getMinutes());
    assertEquals(3, date.getSeconds());
    date = new ISODate();
    date.setDateAndTime("01:02:03");
    assertEquals(false, date.isDateOnly());
    assertEquals(Calendar.getInstance().get(Calendar.YEAR), date.getYears());
    assertEquals(Calendar.getInstance().get(Calendar.MONTH) + 1, date.getMonths());
    assertEquals(Calendar.getInstance().get(Calendar.DAY_OF_MONTH), date.getDays());
    assertEquals(1, date.getHours());
    assertEquals(2, date.getMinutes());
    assertEquals(3, date.getSeconds());
    date = new ISODate();
    date.setDateAndTime("1976-6-3T1:2:3");
    assertEquals(false, date.isDateOnly());
    assertEquals(1976, date.getYears());
    assertEquals(6, date.getMonths());
    assertEquals(3, date.getDays());
    assertEquals(1, date.getHours());
    assertEquals(2, date.getMinutes());
    assertEquals(3, date.getSeconds());
    date = new ISODate();
    date.setDateAndTime("1976-6-3T1:2:3Z");
    assertEquals(false, date.isDateOnly());
    assertEquals(1976, date.getYears());
    assertEquals(6, date.getMonths());
    assertEquals(3, date.getDays());
    assertEquals(1, date.getHours());
    assertEquals(2, date.getMinutes());
    assertEquals(3, date.getSeconds());
    date = new ISODate();
    date.setDateAndTime("1976-6-3T10:02");
    assertEquals(false, date.isDateOnly());
    assertEquals(1976, date.getYears());
    assertEquals(6, date.getMonths());
    assertEquals(3, date.getDays());
    assertEquals(10, date.getHours());
    assertEquals(2, date.getMinutes());
    assertEquals(0, date.getSeconds());
}