private void doTest(String candidate, int expectedHours, int expectedMins) throws ParseException { DateFormat df = new SimpleDateFormat("HH:mm"); Date result = df.parse(candidate); Calendar cal = Calendar.getInstance(); cal.setTime(result); assertEquals(expectedHours, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(expectedMins, cal.get(Calendar.MINUTE)); }
/* * (non-Javadoc) * * @see net.cockamamy.fauxflix.util.csv.AbstractPropertyConverterTest# * provideConvertValueData() */ @Override protected Object[][] buildConvertValueSuccessData() { Object[][] theData = new Object[3][2]; Calendar aCalendar = Calendar.getInstance(); aCalendar.set(2008, 0, 1, 0, 0); aCalendar.set(SECOND, 0); aCalendar.set(MILLISECOND, 0); theData[0][0] = "01/01/2008"; theData[0][1] = aCalendar.getTime(); theData[1][0] = null; theData[1][1] = null; theData[2][0] = ""; theData[2][1] = null; return theData; }