Skip to content

Commit

Permalink
Merge pull request #14805 from glefloch/fix/14799
Browse files Browse the repository at this point in the history
Fix test in sample gradle projects
  • Loading branch information
glefloch authored Feb 4, 2021
2 parents 188f646 + 76d807a commit 8c7b1b5
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public void testRemoveNonExistentExtension() throws IOException, URISyntaxExcept

final File projectDir = getProjectDir("add-remove-extension-single-module-kts");

runGradleWrapper(projectDir, "clean", "build");
BuildResult buildResult = runGradleWrapper(projectDir, "clean", "build");
assertThat(buildResult.getTasks().get(":test")).isEqualTo(BuildResult.SUCCESS_OUTCOME);

final Path buildKts = projectDir.toPath().resolve("build.gradle.kts");
assertThat(buildKts).exists();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public void testRemoveNonExistentExtension() throws IOException, URISyntaxExcept

final File projectDir = getProjectDir("add-remove-extension-single-module");

runGradleWrapper(projectDir, "clean", "build");
BuildResult buildResult = runGradleWrapper(projectDir, "clean", "build");
assertThat(buildResult.getTasks().get(":test")).isEqualTo(BuildResult.SUCCESS_OUTCOME);

final Path build = projectDir.toPath().resolve("build.gradle");
assertThat(build).exists();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,12 @@
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.eclipse.microprofile.config.inject.ConfigProperty;

@Path("/hello")
public class ExampleResource {

@ConfigProperty(name = "my-app-name")
String appName;
@ConfigProperty(name = "quarkus.application.version")
String appVersion;

@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return appName + " " + appVersion;
return "Hello from Test";
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# Configuration file
# key = value
my-app-name=${quarkus.application.name}
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,4 @@ public void testHelloEndpoint() {
.statusCode(200)
.body(is("Hello from Test"));
}

@Test
public void testTestOnly() {
given()
.when().get("test-only")
.then()
.statusCode(200)
.body(is("Test only"));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Configuration file
# key = value
example.message=Hello from Test
test-only=Test only

Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,12 @@
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.eclipse.microprofile.config.inject.ConfigProperty;

@Path("/hello")
public class ExampleResource {

@ConfigProperty(name = "my-app-name")
String appName;
@ConfigProperty(name = "quarkus.application.version")
String appVersion;

@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return appName + " " + appVersion;
return "Hello from Test";
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# Configuration file
# key = value
my-app-name=${quarkus.application.name}
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,4 @@ public void testHelloEndpoint() {
.statusCode(200)
.body(is("Hello from Test"));
}

@Test
public void testTestOnly() {
given()
.when().get("test-only")
.then()
.statusCode(200)
.body(is("Test only"));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Configuration file
# key = value
example.message=Hello from Test
test-only=Test only

0 comments on commit 8c7b1b5

Please sign in to comment.