### Question:
DailyTaskAdaptor extends QBeanSupport implements Runnable { protected void waitUntilStartTime() { Date when = getWhen(); while (running()) { Date now = new GregorianCalendar().getTime(); if (now.before (when)) { long sleepTime = when.getTime() - now.getTime(); if (sleepTime <= 0) { ISOUtil.sleep(1000); continue; } getLog().info ("sleeping", sleepTime/1000 + " secs until " + when.toString() ); try { Thread.sleep (sleepTime); } catch (InterruptedException e) { when = getWhen(); } } else break; } } DailyTaskAdaptor(); void run(); Date getWhen();  }### Answer:
@Test public void testWaitUntilStartTimeThrowsNullPointerException() throws Throwable { DailyTaskAdaptor dailyTaskAdaptor = new DailyTaskAdaptor(); try { dailyTaskAdaptor.waitUntilStartTime(); 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 testWaitUntilStartTimeThrowsNumberFormatException() throws Throwable { DailyTaskAdaptor dailyTaskAdaptor = new DailyTaskAdaptor(); Configuration cfg = new SimpleConfiguration(); dailyTaskAdaptor.setConfiguration(cfg); try { dailyTaskAdaptor.waitUntilStartTime(); fail("Expected NumberFormatException to be thrown"); } catch (NumberFormatException ex) { assertEquals("For input string: \":0\"", ex.getMessage(), "ex.getMessage()"); assertSame(cfg, dailyTaskAdaptor.getConfiguration(), "dailyTaskAdaptor.getConfiguration()"); } }