Workspace implements Serializable { public void addFile(File file, Hierarchy hierarchy) { Validate.notNull(file, "File can't be null"); ProjectMetadata metadata = getMetadata(file.getProject()); Validate.notNull(metadata, "Project must be opened:" + file.getProject()); metadata.addFile(file); metadata.setHierarchy(hierarchy); } Workspace(Map<Project, ProjectMetadata> projectMetadata,
            Set<File> predefinedFiles, List<PreferencesFile> preferencesFiles); int getProjectCount(); List<Project> getProjects(); void addProject(Project project); void removeProject(Project project); void addFile(File file, Hierarchy hierarchy); void removeFile(File file, Hierarchy hierarchy); Hierarchy getHierarchy(Project project); Set<File> getFiles(Project project); Set<File> getPredefinedFiles(); List<PreferencesFile> getPreferencesFiles(); @Override String toString();  }
@SuppressWarnings("unchecked") @Test(expected = IllegalArgumentException.class) public void addFile() { workspace.addFile(null, new Hierarchy(new Project(), Collections.EMPTY_LIST)); }
@Test(expected = IllegalArgumentException.class) public void addFile2() { File file = new File(); file.setProject(firstProject); workspace.addFile(file, null); }
@SuppressWarnings("unchecked") @Test(expected = IllegalArgumentException.class) public void addFile3() { Project project = new Project(); File file = new File(); file.setProject(project); workspace.addFile(file, new Hierarchy(project, Collections.EMPTY_LIST)); }