Skip to content

Commit 0e57a60

Browse files
authored
Merge pull request quarkusio#47866 from holly-cummins/reproducer-for-47760
Add tests for gradle case where a package private class is in a test fixture
2 parents b0ccf1e + 7950973 commit 0e57a60

File tree

8 files changed

+127
-0
lines changed

8 files changed

+127
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
plugins {
2+
id 'java'
3+
id 'java-test-fixtures'
4+
id 'io.quarkus'
5+
}
6+
7+
repositories {
8+
mavenLocal {
9+
content {
10+
includeGroupByRegex 'io.quarkus.*'
11+
includeGroup 'org.hibernate.orm'
12+
}
13+
}
14+
mavenCentral()
15+
}
16+
17+
dependencies {
18+
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
19+
implementation 'io.quarkus:quarkus-resteasy'
20+
21+
testImplementation 'io.quarkus:quarkus-junit5'
22+
testImplementation 'io.rest-assured:rest-assured'
23+
}
24+
25+
group 'my-groupId'
26+
version 'my-version'
27+
28+
compileJava {
29+
options.encoding = 'UTF-8'
30+
options.compilerArgs << '-parameters'
31+
}
32+
33+
compileTestJava {
34+
options.encoding = 'UTF-8'
35+
}
36+
37+
test {
38+
systemProperty "java.util.logging.manager", "org.jboss.logmanager.LogManager"
39+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#Quarkus Gradle TS
2+
#Sat May 23 23:11:14 CEST 2020
3+
quarkusPlatformArtifactId=quarkus-bom
4+
quarkusPlatformGroupId=io.quarkus
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
pluginManagement {
2+
repositories {
3+
mavenLocal {
4+
content {
5+
includeGroupByRegex 'io.quarkus.*'
6+
includeGroup 'org.hibernate.orm'
7+
}
8+
}
9+
mavenCentral()
10+
gradlePluginPortal()
11+
}
12+
//noinspection GroovyAssignabilityCheck
13+
plugins {
14+
id 'io.quarkus' version "${quarkusPluginVersion}"
15+
}
16+
}
17+
18+
rootProject.name='io.quarkus.reproducer'
19+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.acme;
2+
3+
import jakarta.ws.rs.GET;
4+
import jakarta.ws.rs.Path;
5+
import jakarta.ws.rs.Produces;
6+
import jakarta.ws.rs.core.MediaType;
7+
8+
@Path("/hello")
9+
public class GreetingResource {
10+
11+
@GET
12+
@Produces(MediaType.TEXT_PLAIN)
13+
public String hello() {
14+
return "Hello from Quarkus REST";
15+
}
16+
}

integration-tests/gradle/src/main/resources/test-fixtures-module-with-package-private-parent/src/main/resources/application.properties

Whitespace-only changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package org.acme;
2+
3+
import static io.restassured.RestAssured.given;
4+
import static org.hamcrest.CoreMatchers.is;
5+
6+
import org.junit.jupiter.api.Test;
7+
8+
import io.quarkus.test.junit.QuarkusTest;
9+
10+
@QuarkusTest
11+
class ChildTest extends ParentTest {
12+
@Test
13+
void testHelloEndpoint() {
14+
given()
15+
.when().get("/hello")
16+
.then()
17+
.statusCode(200)
18+
.body(is("Hello from Quarkus REST"));
19+
}
20+
21+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.acme;
2+
3+
class ParentTest {
4+
5+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package io.quarkus.gradle;
2+
3+
import static org.assertj.core.api.Assertions.assertThat;
4+
5+
import java.io.File;
6+
import java.io.IOException;
7+
import java.net.URISyntaxException;
8+
9+
import org.junit.jupiter.api.Disabled;
10+
import org.junit.jupiter.api.Test;
11+
12+
public class TestFixtureModuleWithPackagePrivateParentTest extends QuarkusGradleWrapperTestBase {
13+
14+
@Disabled("See https://github.com/quarkusio/quarkus/issues/47760")
15+
@Test
16+
public void testTaskShouldUseTestFixtures() throws IOException, URISyntaxException, InterruptedException {
17+
final File projectDir = getProjectDir("test-fixtures-module-with-package-private-parent");
18+
19+
final BuildResult result = runGradleWrapper(projectDir, "clean", "test");
20+
21+
assertThat(BuildResult.isSuccessful(result.getTasks().get(":test"))).isTrue();
22+
}
23+
}

0 commit comments

Comments
 (0)