private static File getReportsDirectoryFromProperty(Project project) { String path = (String) project.getProperty(SUREFIRE_REPORTS_PATH_PROPERTY); if (StringUtils.isBlank(path)) { path = (String) project.getProperty(SUREFIRE_REPORTS_PATH_DEPRECATED_PROPERTY); } if (path != null) { return project.getFileSystem().resolvePath(path); } return null; }
@Test public void testGetReportWithProperty() { File desired = new File(getClass().getResource("big/pylint.txt").getFile()); String dir = desired.getParent(); ProjectFileSystem fileSystem = mock(ProjectFileSystem.class); when(fileSystem.resolvePath(anyString())).thenReturn(new File(dir)); when(project.getFileSystem()).thenReturn(fileSystem); when(project.getProperty(PyLintUtils.PYLINT_REPORT_PATH_PROPERTY)).thenReturn(dir); File report = PyLintUtils.getReport(project); assertEquals(desired, report); }