### Question:
DailyTaskAdaptor extends QBeanSupport implements Runnable { public Date getWhen() { String s = cfg.get ("start")+":00:00"; int hh = Integer.parseInt(s.substring (0, 2)); int mm = Integer.parseInt(s.substring (3, 5)); int ss = Integer.parseInt(s.substring (6, 8)); Date now = new Date(); Calendar cal = new GregorianCalendar(); cal.setTime (now); cal.set (Calendar.HOUR_OF_DAY, hh); cal.set (Calendar.MINUTE, mm); cal.set (Calendar.SECOND, ss); Date when = cal.getTime(); if (when.before(now)) when = new Date(when.getTime() + 24*60*60*1000); return when; } DailyTaskAdaptor(); void run(); Date getWhen();  }### Answer:
@Test public void testGetWhenThrowsNullPointerException() throws Throwable { DailyTaskAdaptor dailyTaskAdaptor = new DailyTaskAdaptor(); try { dailyTaskAdaptor.getWhen(); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"org.jpos.core.Configuration.get(String)\" because \"this.cfg\" is null", ex.getMessage(), "ex.getMessage()"); } assertNull(dailyTaskAdaptor.getConfiguration(), "dailyTaskAdaptor.getConfiguration()"); } }
@Test public void testGetWhenThrowsNumberFormatException() throws Throwable { Configuration cfg = new SimpleConfiguration(); DailyTaskAdaptor dailyTaskAdaptor = new DailyTaskAdaptor(); dailyTaskAdaptor.setConfiguration(cfg); try { dailyTaskAdaptor.getWhen(); fail("Expected NumberFormatException to be thrown"); } catch (NumberFormatException ex) { assertEquals("For input string: \":0\"", ex.getMessage(), "ex.getMessage()"); assertSame(cfg, dailyTaskAdaptor.getConfiguration(), "dailyTaskAdaptor.getConfiguration()"); } }
@Test public void testGetWhen() { }