Skip to content
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

Fix test in sample gradle projects #14805

Merged
merged 1 commit into from
Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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