### Question:
DefaultWorkingDirectoryService implements WorkingDirectoryService { public File getWorkingDirectory( Project project ) { return getWorkingDirectory( project, null, null ); }  void setConfigurationService( ConfigurationService configurationService ); ConfigurationService getConfigurationService(); File getWorkingDirectory( Project project ); File getWorkingDirectory( Project project, boolean shouldSet ); File getWorkingDirectory( Project project, String projectScmRoot, List<Project> projects ); File getWorkingDirectory( Project project, String projectScmRoot, List<Project> projects, boolean shouldSet );  }### Answer:
@Test public void testGetWorkingDirectoryOfSingleCheckoutFlatMultiModules() throws Exception { List<Project> projects = new ArrayList<Project>(); Project project = createProject( 7, "org.apache.continuum", "module-a", "1.0-SNAPSHOT", "scm:local:src/test-projects:flat-multi-module/module-a", true ); projects.add( project ); projects.add( createProject( 8, "org.apache.continuum", "module-b", "1.0-SNAPSHOT", "scm:local:src/test-projects:flat-multi-module/module-b", true ) ); projects.add( createProject( 6, "org.apache.continuum", "parent-project", "1.0-SNAPSHOT", "scm:local:src/test-projects:flat-multi-module/parent-project", true ) ); File projectWorkingDirectory = workingDirectoryService.getWorkingDirectory( project, "scm:local:src/test-projects:flat-multi-module", projects ); assertEquals( "Incorrect working directory for flat multi-module project", baseWorkingDirectory + File.separator + "6" + File.separator + "module-a", projectWorkingDirectory.getPath() ); projectWorkingDirectory = workingDirectoryService.getWorkingDirectory( project, "scm:local:src/test-projects:flat-multi-module/", projects ); assertEquals( "Incorrect working directory for flat multi-module project", baseWorkingDirectory + File.separator + "6" + File.separator + "module-a", projectWorkingDirectory.getPath() ); }
@Test public void testGetWorkingDirectoryOfSingleCheckoutRegularMultiModules() throws Exception { List<Project> projects = new ArrayList<Project>(); Project project = createProject( 10, "org.apache.continuum", "module-a", "1.0-SNAPSHOT", "scm:local:src/test-projects:regular-multi-module/module-a", true ); projects.add( project ); projects.add( createProject( 11, "org.apache.continuum", "module-b", "1.0-SNAPSHOT", "scm:local:src/test-projects:regular-multi-module/module-b", true ) ); projects.add( createProject( 9, "org.apache.continuum", "parent-project", "1.0-SNAPSHOT", "scm:local:src/test-projects:regular-multi-module/", true ) ); File projectWorkingDirectory = workingDirectoryService.getWorkingDirectory( project, "scm:local:src/test-projects:regular-multi-module", projects ); assertEquals( "Incorrect working directory for regular multi-module project", baseWorkingDirectory + File.separator + "9" + File.separator + "module-a", projectWorkingDirectory.getPath() ); projectWorkingDirectory = workingDirectoryService.getWorkingDirectory( project, "scm:local:src/test-projects:regular-multi-module/", projects ); assertEquals( "Incorrect working directory for regular multi-module project", baseWorkingDirectory + File.separator + "9" + File.separator + "module-a", projectWorkingDirectory.getPath() ); project = createProject( 9, "org.apache.continuum", "parent-project", "1.0-SNAPSHOT", "scm:local:src/test-projects:regular-multi-module", true ); projectWorkingDirectory = workingDirectoryService.getWorkingDirectory( project, "scm:local:src/test-projects:regular-multi-module", projects ); assertEquals( "Incorrect working directory for regular multi-module project", baseWorkingDirectory + File.separator + "9", projectWorkingDirectory.getPath() ); }