-
-
Notifications
You must be signed in to change notification settings - Fork 528
Fix the failed test due to hardcoded file separators #2366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I stumbled upon the same issue; maybe we can, at the same time, avoid using hardcoded "version" in the expected String, e.g.?
|
Yeah...I knew I could go a little bit fancier using Now since you mentioned it, instead of using assertEquals(Paths.get("swagger-ui" ,"4.18.2" ,"swagger-initializer.js").toString(), actual); Additionally, I went back to see if I could clean it up more. So the method that constructs the
I can further clean up the logic there by utilizing |
So, as my last comment mentioned, the implementation of protected String findWebJarResourcePath(String pathStr) {
Path path = Paths.get(pathStr);
if (path.getNameCount() < 2) return null;
String version = swaggerUiConfigProperties.getVersion();
if (version == null) return null;
Path first = path.getName(0);
Path rest = path.subpath(1, path.getNameCount());
return first.resolve(version).resolve(rest).toString();
} Which eliminates the only references to the private methods |
Thank you, @wnineg, for your answer. I agree. I created a "fix" before I saw that you had already done it, so I just compared/commented solutions, also without going into details. |
Fix the failed test due to hardcoded file separators
This specific test fails under Windows: the
actual
path utilizedFile.separator
but not the expected one.