### Question:
NucleoConsole { public void setName(String newName) { if(newName.length()>7){ throw new IllegalArgumentException("Name must be shorter than 7 chars"); } if(newName.isEmpty()){ throw new IllegalArgumentException("Name must not be empty"); } String command = String.format(Locale.getDefault(),SET_NAME_COMMAND_FORMAT,newName); 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 hasCommandSetName(){ final String newName = "NEWNAME"; mNucleo.setName(newName); verify(mConsole).write("setName "+newName+"\n"); }
@Test(expected = IllegalArgumentException.class) public void nameIsSmallerThan7Char(){ final String longName = "LooooooooooongName"; mNucleo.setName(longName); }
@Test(expected = IllegalArgumentException.class) public void nameMustNotBeEmpty(){ mNucleo.setName(""); }