### Question:
SakuliFolderHelper { public static String checkSakuliHomeFolderAndSetContextVariables(String sakuliMainFolderPath, String tempLogCache) throws FileNotFoundException { Path normalizedPath = normalizePath(sakuliMainFolderPath); Path mainFolderPath = normalizedPath != null ? normalizedPath : getAlternativeSakuliMainFolder(); if (!Files.exists(mainFolderPath)) { throw new FileNotFoundException("SAKULI HOME folder \"" + mainFolderPath + "\" does not exist!"); } if (!checkSubMainFolder(mainFolderPath)) { throw new FileNotFoundException("the assigned SAKULI HOME folder \"" + mainFolderPath + "\" does not have a valid file structure! Please use the correct folder!"); } SakuliPropertyPlaceholderConfigurer.SAKULI_HOME_FOLDER_VALUE = mainFolderPath.normalize().toAbsolutePath().toString(); return tempLogCache + "\nset property '" + SakuliProperties.SAKULI_HOME_FOLDER + "' to \"" + SakuliPropertyPlaceholderConfigurer.SAKULI_HOME_FOLDER_VALUE + "\""; }  static String checkTestSuiteFolderAndSetContextVariables(String testSuiteFolderPath, String tempLogCache); static Path normalizePath(String path); static String checkSakuliHomeFolderAndSetContextVariables(String sakuliMainFolderPath, String tempLogCache); static String checkSahiProxyHomeAndSetContextVariables(String sahiProxyHomePath, String tempLogCache); static String setTestSuiteBrowserContextVariable(String testSuiteBrowserName, String tempLogCache);  }### Answer:
@Test public void testCheckHomeFolder() throws Exception { Path path = Paths.get(BaseTest.SAKULI_HOME_FOLDER_PATH); assertTrue(Files.exists(path)); SakuliFolderHelper.checkSakuliHomeFolderAndSetContextVariables(path.toString(), ""); assertEquals(SakuliPropertyPlaceholderConfigurer.SAKULI_HOME_FOLDER_VALUE, path.toAbsolutePath().normalize().toString()); }
@Test(expectedExceptions = FileNotFoundException.class, expectedExceptionsMessageRegExp = ".*not have a valid file structure! Please use the correct folder!") public void testCheckHomeFolderNotValid() throws Exception { Path path = Paths.get("./src"); assertTrue(Files.exists(path)); SakuliFolderHelper.checkSakuliHomeFolderAndSetContextVariables(path.toString(), ""); }
@Test(expectedExceptions = FileNotFoundException.class, expectedExceptionsMessageRegExp = "no valid SAKULI HOME folder specified - please configure one!") public void testCheckHomeFolderNotDefined() throws Exception { System.clearProperty("SAKULI_HOME"); String envSakuliHome = System.getenv("SAKULI_HOME"); assertTrue(StringUtils.isBlank(envSakuliHome) || envSakuliHome.equalsIgnoreCase("null")); SakuliFolderHelper.checkSakuliHomeFolderAndSetContextVariables(null, ""); }