Skip to content

Commit 335b9fd

Browse files
committed
fix syntax error add only EnabledIf
1 parent 4468397 commit 335b9fd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-ant/src/test/java/smoketest/ant/SampleAntApplicationIT.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
class SampleAntApplicationIT {
3737

3838
@Test
39-
@EnabledIf("isJavaExecutableAvailable")
40-
@EnabledIf("isJarAvailable")
39+
@EnabledIf("isTestEnabled")
4140
void runJar() throws Exception {
4241
File buildDir = new File("build");
4342
System.out.println("Build directory exists: " + buildDir.exists());
@@ -63,7 +62,6 @@ void runJar() throws Exception {
6362
}
6463

6564
ProcessBuilder processBuilder = new ProcessBuilder("java", "-jar", jarName);
66-
processBuilder.inheritIO();
6765
// Set PATH to include Java bin directory
6866
java.util.Map<String, String> env = processBuilder.environment();
6967
String currentPath = env.get("PATH");
@@ -72,6 +70,7 @@ void runJar() throws Exception {
7270
process.waitFor(5, TimeUnit.MINUTES);
7371
assertThat(process.exitValue()).isZero();
7472
String output = FileCopyUtils.copyToString(new InputStreamReader(process.getInputStream()));
73+
System.out.println("Application output: '" + output + "'");
7574
assertThat(output).contains("Spring Boot Ant Example");
7675
}
7776

@@ -113,4 +112,8 @@ boolean isJarAvailable() {
113112
return jarFiles != null && jarFiles.length > 0;
114113
}
115114

115+
boolean isTestEnabled() {
116+
return isJavaExecutableAvailable() && isJarAvailable();
117+
}
118+
116119
}

0 commit comments

Comments
 (0)