@Test @PrepareForTest(ProjectFile.class) public void testFind() throws IOException { final String packageName = randomUUID().toString(); final ProjectFile projectFile = new ProjectFile(); final PackageManager packageManager = new PackageManager(); PowerMockito.mockStatic(ProjectFile.class); when(ProjectFile.from(any(Path.class))).thenReturn(projectFile); packageManager.find(packageName); }
public ResourceManager find(final String packageName) { final String packageLocation = append(repositoryLocation, packageName); final String projectFileLocation = append(packageLocation, ShipConstants.PROJECT_FILENAME); try { final Path projectFilePath = Paths.get(projectFileLocation); final ProjectFile projectFile = ProjectFile.from(projectFilePath); return new ResourceManager(new Project(packageLocation, projectFile)); } catch (final IOException ex) { throw new PackageNotFoundException(packageName, projectFileLocation, ex); } }
PackageManager { public ResourceManager find(final String packageName) { final String packageLocation = append(repositoryLocation, packageName); final String projectFileLocation = append(packageLocation, ShipConstants.PROJECT_FILENAME); try { final Path projectFilePath = Paths.get(projectFileLocation); final ProjectFile projectFile = ProjectFile.from(projectFilePath); return new ResourceManager(new Project(packageLocation, projectFile)); } catch (final IOException ex) { throw new PackageNotFoundException(packageName, projectFileLocation, ex); } } }
PackageManager { public ResourceManager find(final String packageName) { final String packageLocation = append(repositoryLocation, packageName); final String projectFileLocation = append(packageLocation, ShipConstants.PROJECT_FILENAME); try { final Path projectFilePath = Paths.get(projectFileLocation); final ProjectFile projectFile = ProjectFile.from(projectFilePath); return new ResourceManager(new Project(packageLocation, projectFile)); } catch (final IOException ex) { throw new PackageNotFoundException(packageName, projectFileLocation, ex); } } PackageManager(); }
PackageManager { public ResourceManager find(final String packageName) { final String packageLocation = append(repositoryLocation, packageName); final String projectFileLocation = append(packageLocation, ShipConstants.PROJECT_FILENAME); try { final Path projectFilePath = Paths.get(projectFileLocation); final ProjectFile projectFile = ProjectFile.from(projectFilePath); return new ResourceManager(new Project(packageLocation, projectFile)); } catch (final IOException ex) { throw new PackageNotFoundException(packageName, projectFileLocation, ex); } } PackageManager(); ResourceManager find(final String packageName); }
PackageManager { public ResourceManager find(final String packageName) { final String packageLocation = append(repositoryLocation, packageName); final String projectFileLocation = append(packageLocation, ShipConstants.PROJECT_FILENAME); try { final Path projectFilePath = Paths.get(projectFileLocation); final ProjectFile projectFile = ProjectFile.from(projectFilePath); return new ResourceManager(new Project(packageLocation, projectFile)); } catch (final IOException ex) { throw new PackageNotFoundException(packageName, projectFileLocation, ex); } } PackageManager(); ResourceManager find(final String packageName);  }