### Question:
SakuliFolderHelper { public static String checkTestSuiteFolderAndSetContextVariables(String testSuiteFolderPath, String tempLogCache) throws FileNotFoundException { Path testSuiteFolder = normalizePath(testSuiteFolderPath); Path propertyFile = Paths.get(testSuiteFolder + TestSuiteProperties.TEST_SUITE_PROPERTIES_FILE_APPENDER); Path suiteFile = Paths.get(testSuiteFolder + TestSuiteProperties.TEST_SUITE_SUITE_FILE_APPENDER); if (testSuiteFolder == null || !Files.exists(testSuiteFolder)) { throw new FileNotFoundException("sakuli test suite folder \"" + testSuiteFolderPath + "\" does not exist!"); } else if (!Files.exists(propertyFile)) { throw new FileNotFoundException("property file \"" + TestSuiteProperties.TEST_SUITE_PROPERTIES_FILE_NAME + "\" does not exist in folder: " + testSuiteFolderPath); } else if (!Files.exists(suiteFile)) { throw new FileNotFoundException("suite file \"" + TestSuiteProperties.TEST_SUITE_SUITE_FILE_NAME + "\" does not exist in folder: " + testSuiteFolderPath); } SakuliPropertyPlaceholderConfigurer.TEST_SUITE_FOLDER_VALUE = testSuiteFolder.toAbsolutePath().toString(); return tempLogCache + "\nset property '" + TestSuiteProperties.TEST_SUITE_FOLDER + "' to \"" + SakuliPropertyPlaceholderConfigurer.TEST_SUITE_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 testCheckTestSuiteFolderAndSetContextVariables() throws Exception { final String absoluteTestSuitePath = Paths.get(TEST_FOLDER_PATH).toAbsolutePath().toString(); String log = ""; log = SakuliFolderHelper.checkTestSuiteFolderAndSetContextVariables(TEST_FOLDER_PATH, log); assertEquals(SakuliPropertyPlaceholderConfigurer.TEST_SUITE_FOLDER_VALUE, absoluteTestSuitePath); assertEquals(log, "\nset property '" + TestSuiteProperties.TEST_SUITE_FOLDER + "' to \"" + absoluteTestSuitePath + "\""); }
@Test(expectedExceptions = FileNotFoundException.class, expectedExceptionsMessageRegExp = "sakuli test suite folder .* does not exist!") public void testCheckTestSuiteFolderAndSetContextVariablesFolderMissing() throws Exception { SakuliFolderHelper.checkTestSuiteFolderAndSetContextVariables("not-valid-path/to-suite", ""); }
@Test(expectedExceptions = FileNotFoundException.class, expectedExceptionsMessageRegExp = "property file \"testsuite.properties\" does not exist in folder.*") public void testCheckTestSuiteFolderAndSetContextVariablesSuitePropertyMissing() throws Exception { Path path = Paths.get(getClass().getResource("unvalid").toURI()); assertTrue(Files.exists(path)); SakuliFolderHelper.checkTestSuiteFolderAndSetContextVariables(path.toString(), ""); }
@Test(expectedExceptions = FileNotFoundException.class, expectedExceptionsMessageRegExp = "suite file \"testsuite.suite\" does not exist in folder.*") public void testCheckTestSuiteFolderAndSetContextVariablesSuiteFileMissing() throws Exception { Path path = Paths.get(getClass().getResource("unvalid2").toURI()); assertTrue(Files.exists(path)); SakuliFolderHelper.checkTestSuiteFolderAndSetContextVariables(path.toString(), ""); }