GitHub user GabrielBrascher opened a pull request: https://github.com/apache/cloudstack/pull/1498
Test fails in Widows as the file separator "/" is different from "\" **Problem:** File separator in windows ("\") is different from the expected in the test ("/"); thus, the test *com.cloud.utils.SwiftUtilTest.testSplitSwiftPath()* will fail in Windows systems. The problem is that the input of the test is *"container/object"* but the tested method uses the *File.separator* (that depends on from the OS), in the windows the tested method (*com.cloud.utils.SwiftUtil.splitSwiftPath(String)*) looks for a "\", as the string does not contain "\" it returns an empty string and consequently results in a test failure. **Solution:** - Create a string `String input = "container" + File.separator + "object";` (before it was `String input = "container/object";`); thus, independent of the OS, the test will validate the tested method in a manner that the file separator does not disturb the result; You can merge this pull request into a Git repository by running: $ git pull https://github.com/GabrielBrascher/cloudstack lrg-cs-hackday-038 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cloudstack/pull/1498.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1498 ---- commit a83514041cd865b06bee33d2440ea42b1e7c1337 Author: gabrascher <gabrasc...@hotmail.com> Date: 2016-04-16T18:35:17Z Test fails in Widows as the file separator "/" is different from "\" File separator in windows is different from linux (the expected in the test); thus, the test *com.cloud.utils.SwiftUtilTest.testSplitSwiftPath()* will fail in windows. The problem is that the input of the test is *"container/object"* but the tested method uses the *File.separator* (that depends from the OS), in the windows the tested method (*com.cloud.utils.SwiftUtil.splitSwiftPath(String)*) looks for a "\" in windows systems, resulting in an empty string and consequently a failure in the test. Some solutions: - the simple way is to create a string `String input = "container" + File.separator + "object";`, thus independent of the OS, the test will succeed. - a tricky solution is to mock the final static variable *File.separator* and return "/". I picked the easy way. ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---