### Question:
NucleoConsole { public void setDate(Date date) { String dateStr = SET_DATE_FORMAT.format(date); int dayOfTheWeek = getDayOfTheWeek(date); String command = String.format(Locale.getDefault(),SET_DATE_COMMAND_FORMAT,dayOfTheWeek,dateStr); mConsole.write(command); } NucleoConsole(Debug console); void setName(String newName); void setTime(Date date); void setDate(Date date); void setDateAndTime(Date date);  }### Answer:
@Test public void canSetTheDate(){ Date date = new GregorianCalendar(2001,01,03,04,05,06).getTime(); mNucleo.setDate(date); verify(mConsole).write("setDate 06/03/02/01\n"); }
@Test public void setDateCommandIsSmallerThan20byte(){ Date date = new GregorianCalendar(2001,01,03,04,05,06).getTime(); mNucleo.setDate(date); ArgumentCaptor<String> commandCapture = ArgumentCaptor.forClass(String.class); verify(mConsole).write(commandCapture.capture()); Assert.assertTrue(commandCapture.getValue().length()<=20); }