public void test_Date_setHour() { Date date = new Date(2005, 12, 30, 12, 15, 45, 1, 2, 0); assertTrue(date != null); int i = date.setHour(434); assertTrue(i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE); assertTrue(date.getHour() == 0); i = date.setHour(12121); assertTrue(i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE); assertTrue(date.getHour() == 0); i = date.setHour(9); assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS); assertTrue(date.getHour() == 9); assertTrue(date.getDateAsString().equals("2005-12-30T09:15:45+02:00")); date = null; }
public void test_Date_setDateAsString() { Date date = new Date(2007, 10, 23, 14, 15, 16, 1, 3, 0); assertTrue(date != null); int i = date.setDateAsString("20081-12-30T12:15:45+02:00"); assertTrue(i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE); assertTrue(date.getDateAsString().equals("2007-10-23T14:15:16+03:00")); i = date.setDateAsString("200-12-30T12:15:45+02:00"); assertTrue(i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE); assertTrue(date.getDateAsString().equals("2007-10-23T14:15:16+03:00")); i = date.setDateAsString(""); assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS); assertTrue(date.getDateAsString().equals("2000-01-01T00:00:00Z")); i = date.setDateAsString("2008-12-30T12:15:45+02:00"); assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS); assertTrue(date.getYear() == 2008); assertTrue(date.getMonth() == 12); assertTrue(date.getDay() == 30); assertTrue(date.getHour() == 12); assertTrue(date.getMinute() == 15); assertTrue(date.getSecond() == 45); assertTrue(date.getSignOffset() == 1); assertTrue(date.getHoursOffset() == 2); assertTrue(date.getMinutesOffset() == 0); date = null; }