Skip to content

Commit 483dba2

Browse files
committed
[swagger-codegen-ignore] Skip file case test Windows
There doesn't appear to be an excellent way to resolve a case sensitive test on Windows, so conditionally skipping the test on Windows. See #3047
1 parent 895f13c commit 483dba2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

modules/swagger-codegen/src/test/java/io/swagger/codegen/ignore/CodegenIgnoreProcessorTest.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.swagger.codegen.ignore;
22

33
import org.apache.commons.io.FileUtils;
4+
import org.apache.commons.lang3.SystemUtils;
45
import org.slf4j.Logger;
56
import org.slf4j.LoggerFactory;
67
import org.testng.annotations.*;
@@ -17,6 +18,7 @@ public class CodegenIgnoreProcessorTest {
1718
private static final Logger LOGGER = LoggerFactory.getLogger(CodegenIgnoreProcessorTest.class);
1819

1920
private Boolean allowed;
21+
private Boolean skip = false;
2022
private final String filename;
2123
private final String ignoreDefinition;
2224
private final String description;
@@ -35,6 +37,11 @@ CodegenIgnoreProcessorTest allowed() {
3537
return this;
3638
}
3739

40+
CodegenIgnoreProcessorTest skipOnCondition(Boolean condition) {
41+
this.skip = Boolean.TRUE.equals(condition);
42+
return this;
43+
}
44+
3845
CodegenIgnoreProcessorTest ignored() {
3946
this.allowed = false;
4047
return this;
@@ -73,6 +80,10 @@ public void afterTest() throws IOException {
7380

7481
@Test
7582
public void evaluate() {
83+
if(this.skip) {
84+
return;
85+
}
86+
7687
// Arrange
7788
try {
7889
// Lazily setup files to avoid conflicts and creation when these tests may not even run.
@@ -97,7 +108,7 @@ public static Object[] factoryMethod() throws IOException {
97108
// Matching filenames
98109
new CodegenIgnoreProcessorTest("build.sh", "build.sh", "A file when matching should ignore.").ignored(),
99110
new CodegenIgnoreProcessorTest("src/build.sh", "**/build.sh", "A file when matching nested files should ignore.").ignored(),
100-
new CodegenIgnoreProcessorTest("Build.sh", "build.sh", "A file when non-matching should allow.").allowed(),
111+
new CodegenIgnoreProcessorTest("Build.sh", "build.sh", "A file when non-matching should allow.").allowed().skipOnCondition(SystemUtils.IS_OS_WINDOWS),
101112
new CodegenIgnoreProcessorTest("build.sh", "/build.sh", "A rooted file when matching should ignore.").ignored(),
102113
new CodegenIgnoreProcessorTest("nested/build.sh", "/build.sh", "A rooted file definition when non-matching should allow.").allowed(),
103114
new CodegenIgnoreProcessorTest("src/IO.Swagger.Test/Model/AnimalFarmTests.cs", "src/IO.Swagger.Test/Model/AnimalFarmTests.cs", "A file when matching exactly should ignore.").ignored(),

0 commit comments

Comments
 (0)