Program: 147598
Project: 147598
Buggy source:
@Test public void testCopyOSFileTOProject() throws Exception {
  String path="String_Node_Str";
  IFolder desFolder=mock(IFolder.class);
  String version=VersionUtils.DEFAULT_VERSION;
  boolean overwrite=true;
  IProgressMonitor progressMonitor=mock(IProgressMonitor.class);
  IProject mockIProject=mock(IProject.class);
  try {
    RepositoryResourceUtil.copyOSFileTOProject(mockIProject,null,desFolder,version,overwrite,progressMonitor);
    fail();
  }
 catch (  Exception e) {
    if (e instanceof IllegalArgumentException) {
      assertTrue(true);
    }
 else {
      assertTrue(false);
    }
  }
  try {
    RepositoryResourceUtil.copyOSFileTOProject(mockIProject,path,null,version,overwrite,progressMonitor);
    fail();
  }
 catch (  Exception e) {
    if (e instanceof IllegalArgumentException) {
      assertTrue(true);
    }
 else {
      assertTrue(false);
    }
  }
  PowerMockito.mockStatic(ProjectManager.class);
  ProjectManager mockProjectManager=mock(ProjectManager.class);
  when(ProjectManager.getInstance()).thenReturn(mockProjectManager);
  Project mockProject=mock(Project.class);
  when(ProjectManager.getInstance().getCurrentProject()).thenReturn(mockProject);
  PowerMockito.mockStatic(ResourceModelUtils.class);
  when(ResourceModelUtils.getProject(mockProject)).thenReturn(mockIProject);
  String invalidPath="String_Node_Str";
  when(desFolder.exists()).thenReturn(true);
  IFile copyOfFile=RepositoryResourceUtil.copyOSFileTOProject(null,invalidPath,desFolder,version,overwrite,progressMonitor);
  PowerMockito.verifyStatic(Mockito.atLeastOnce());
  ProjectManager.getInstance();
  ResourceModelUtils.getProject(Mockito.any(Project.class));
  assertNull(copyOfFile);
  String validPath="String_Node_Str";
  File file=new File(validPath);
  File spyFile=Mockito.spy(file);
  PowerMockito.whenNew(File.class).withArguments(validPath).thenReturn(spyFile);
  when(spyFile.exists()).thenReturn(true);
  when(spyFile.getName()).thenReturn("String_Node_Str");
  IFile mockIFile=mock(IFile.class);
  when(desFolder.getFile(Mockito.anyString())).thenReturn(mockIFile);
  IPath mockIPath=mock(IPath.class);
  when(mockIFile.getLocation()).thenReturn(mockIPath);
  when(mockIPath.toOSString()).thenReturn(validPath);
  FileInputStream inputStream=mock(FileInputStream.class);
  PowerMockito.whenNew(FileInputStream.class).withArguments(spyFile).thenReturn(inputStream);
  IFile copiedFile=RepositoryResourceUtil.copyOSFileTOProject(mockIProject,validPath,desFolder,version,overwrite,progressMonitor);
  assertNotNull(copiedFile);
  verify(inputStream,Mockito.times(1)).close();
}

Fixed version (ground truth):
@Test public void testCopyOSFileTOProject() throws Exception {
  String path="String_Node_Str";
  IFolder desFolder=mock(IFolder.class);
  String version=VersionUtils.DEFAULT_VERSION;
  boolean overwrite=true;
  IProgressMonitor progressMonitor=mock(IProgressMonitor.class);
  IProject mockIProject=mock(IProject.class);
  try {
    RepositoryResourceUtil.copyOSFileTOProject(mockIProject,null,desFolder,version,overwrite,progressMonitor);
    fail();
  }
 catch (  Exception e) {
    if (e instanceof IllegalArgumentException) {
      assertTrue(true);
    }
 else {
      assertTrue(false);
    }
  }
  try {
    RepositoryResourceUtil.copyOSFileTOProject(mockIProject,path,null,version,overwrite,progressMonitor);
    fail();
  }
 catch (  Exception e) {
    if (e instanceof IllegalArgumentException) {
      assertTrue(true);
    }
 else {
      assertTrue(false);
    }
  }
  PowerMockito.mockStatic(ProjectManager.class);
  ProjectManager mockProjectManager=mock(ProjectManager.class);
  when(ProjectManager.getInstance()).thenReturn(mockProjectManager);
  Project mockProject=mock(Project.class);
  when(ProjectManager.getInstance().getCurrentProject()).thenReturn(mockProject);
  PowerMockito.mockStatic(ResourceUtils.class);
  when(ResourceUtils.getProject(mockProject)).thenReturn(mockIProject);
  String invalidPath="String_Node_Str";
  when(desFolder.exists()).thenReturn(true);
  IFile copyOfFile=RepositoryResourceUtil.copyOSFileTOProject(null,invalidPath,desFolder,version,overwrite,progressMonitor);
  PowerMockito.verifyStatic(Mockito.atLeastOnce());
  ProjectManager.getInstance();
  ResourceUtils.getProject(Mockito.any(Project.class));
  assertNull(copyOfFile);
  String validPath="String_Node_Str";
  File file=new File(validPath);
  File spyFile=Mockito.spy(file);
  PowerMockito.whenNew(File.class).withArguments(validPath).thenReturn(spyFile);
  when(spyFile.exists()).thenReturn(true);
  when(spyFile.getName()).thenReturn("String_Node_Str");
  IFile mockIFile=mock(IFile.class);
  when(desFolder.getFile(Mockito.anyString())).thenReturn(mockIFile);
  IPath mockIPath=mock(IPath.class);
  when(mockIFile.getLocation()).thenReturn(mockIPath);
  when(mockIPath.toOSString()).thenReturn(validPath);
  FileInputStream inputStream=mock(FileInputStream.class);
  PowerMockito.whenNew(FileInputStream.class).withArguments(spyFile).thenReturn(inputStream);
  IFile copiedFile=RepositoryResourceUtil.copyOSFileTOProject(mockIProject,validPath,desFolder,version,overwrite,progressMonitor);
  assertNotNull(copiedFile);
  verify(inputStream,Mockito.times(1)).close();
}