FolderLayout { static File getSourceFolder(MavenProject project) { final Properties projectProperties = project.getProperties(); if (projectProperties.containsKey(XCodeDefaultConfigurationMojo.XCODE_SOURCE_DIRECTORY)) { return new File(project.getBasedir(), projectProperties.getProperty(XCodeDefaultConfigurationMojo.XCODE_SOURCE_DIRECTORY)); } return new File(project.getBasedir(), XCodeDefaultConfigurationMojo.DEFAULT_XCODE_SOURCE_DIRECTORY); }    }
@Test public void testDefaultSourceFolder() { final File f = new File(".").getAbsoluteFile(); final MavenProject project = EasyMock.createMock(MavenProject.class); Properties props = new Properties(); EasyMock.expect(project.getProperties()).andReturn(props); EasyMock.expect(project.getBasedir()).andReturn(f); EasyMock.replay(project); assertEquals(new File(f, "src/xcode"), FolderLayout.getSourceFolder(project)); }
@Test public void testModifiedSourceFolder() { final File f = new File(".").getAbsoluteFile(); final MavenProject project = EasyMock.createMock(MavenProject.class); Properties props = new Properties(); props.setProperty(XCodeDefaultConfigurationMojo.XCODE_SOURCE_DIRECTORY, "src/myxcode"); EasyMock.expect(project.getProperties()).andReturn(props); EasyMock.expect(project.getBasedir()).andReturn(f); EasyMock.replay(project); assertEquals(new File(f, "src/myxcode"), FolderLayout.getSourceFolder(project)); }