### Question:
ConfigurationUtils { File getHomeDir() { File homeDir; String repoHomePath = bundleContext.getProperty(SLING_REPOSITORY_HOME); String slingHomePath = bundleContext.getProperty(SLING_HOME); String repositoryName = getRepositoryName(); if (repoHomePath != null) { homeDir = new File(repoHomePath, repositoryName); } else if (slingHomePath != null) { homeDir = new File(slingHomePath, repositoryName); } else { homeDir = new File(repositoryName); } log.info("Creating default config for Modeshape in " + homeDir); if (!homeDir.isDirectory()) { if (!homeDir.mkdirs()) { log.info("verifyConfiguration: Cannot create Modeshape home " + homeDir + ", failed creating default configuration"); return null; } } return homeDir; } ConfigurationUtils( BundleContext bundleContext );   }### Answer:
@Test public void shouldReturnRepositoryNameWhenNoPropertySet() throws Exception { BundleContext bundleContext = programBundleContextToReturn(null, null); ConfigurationUtils configurationUtil = new ConfigurationUtils(bundleContext); File homeDir = configurationUtil.getHomeDir(); assertEquals("modeshape", homeDir.getPath()); }
@Test public void shouldReturnHomeDirSetUsingPropertySlingRepositoryHome() throws Exception { BundleContext bundleContext = programBundleContextToReturn("aPath", null); ConfigurationUtils configurationUtil = new ConfigurationUtils(bundleContext); File homeDir = configurationUtil.getHomeDir(); assertEquals("aPath/modeshape", homeDir.getPath()); }
@Test public void shouldReturnHomeDirSetUsingPropertySlingHome() throws Exception { BundleContext bundleContext = programBundleContextToReturn(null, "aPath"); ConfigurationUtils configurationUtil = new ConfigurationUtils(bundleContext); File homeDir = configurationUtil.getHomeDir(); assertEquals("aPath/modeshape", homeDir.getPath()); }