Directory implements Serializable { public void validate() throws CruiseControlException { if (directory == null) { throw new DirectoryNotSpecifiedException("directory"); } if (!exists()) { throw new DirectoryDoesNotExistException(); } if (!isDirectory()) { throw new FileInsteadOfDirectoryException(); } }  void validate(); boolean exists(); boolean isDirectory(); void setPath(String path); File toFile();  }
@Test(expected = Directory.DirectoryNotSpecifiedException.class) public void validateShouldFailIfPathNotSpecified() throws CruiseControlException { Directory directory = new Directory(); directory.validate(); }