-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new tests to cover JUnit @testtemplate
- Loading branch information
1 parent
43781d1
commit b8b1069
Showing
16 changed files
with
717 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
integration-tests/maven/src/test/resources-filtered/projects/test-template/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.acme</groupId> | ||
<artifactId>quarkus-test-template</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<properties> | ||
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id> | ||
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id> | ||
<quarkus.platform.version>@project.version@</quarkus.platform.version> | ||
<quarkus-plugin.version>@project.version@</quarkus-plugin.version> | ||
<compiler-plugin.version>${compiler-plugin.version}</compiler-plugin.version> | ||
<surefire-plugin.version>${version.surefire.plugin}</surefire-plugin.version> | ||
<maven.compiler.source>${maven.compiler.source}</maven.compiler.source> | ||
<maven.compiler.target>${maven.compiler.target}</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>\${quarkus.platform.group-id}</groupId> | ||
<artifactId>\${quarkus.platform.artifact-id}</artifactId> | ||
<version>\${quarkus.platform.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-resteasy</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.rest-assured</groupId> | ||
<artifactId>rest-assured</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>\${surefire-plugin.version}</version> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> | ||
<maven.home>\${maven.home}</maven.home> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-maven-plugin</artifactId> | ||
<version>\${quarkus-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
|
||
<profiles> | ||
<profile> | ||
<id>native</id> | ||
<activation> | ||
<property> | ||
<name>native</name> | ||
</property> | ||
</activation> | ||
<properties> | ||
<quarkus.native.enabled>true</quarkus.native.enabled> | ||
</properties> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<skipTests>\${native.surefire.skip}</skipTests> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>\${surefire-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<native.image.path>\${project.build.directory}/\${project.build.finalName}-runner</native.image.path> | ||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> | ||
<maven.home>\${maven.home}</maven.home> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
</project> |
16 changes: 16 additions & 0 deletions
16
.../test/resources-filtered/projects/test-template/src/main/java/org/acme/HelloResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.acme; | ||
|
||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.Produces; | ||
import jakarta.ws.rs.core.MediaType; | ||
|
||
@Path("/hello") | ||
public class HelloResource { | ||
|
||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String hello() { | ||
return "hello"; | ||
} | ||
} |
Empty file.
154 changes: 154 additions & 0 deletions
154
...esources-filtered/projects/test-template/src/main/resources/META-INF/resources/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>getting-started - 1.0-SNAPSHOT</title> | ||
<style> | ||
h1, h2, h3, h4, h5, h6 { | ||
margin-bottom: 0.5rem; | ||
font-weight: 400; | ||
line-height: 1.5; | ||
} | ||
|
||
h1 { | ||
font-size: 2.5rem; | ||
} | ||
|
||
h2 { | ||
font-size: 2rem | ||
} | ||
|
||
h3 { | ||
font-size: 1.75rem | ||
} | ||
|
||
h4 { | ||
font-size: 1.5rem | ||
} | ||
|
||
h5 { | ||
font-size: 1.25rem | ||
} | ||
|
||
h6 { | ||
font-size: 1rem | ||
} | ||
|
||
.lead { | ||
font-weight: 300; | ||
font-size: 2rem; | ||
} | ||
|
||
.banner { | ||
font-size: 2.7rem; | ||
margin: 0; | ||
padding: 2rem 1rem; | ||
background-color: #00A1E2; | ||
color: white; | ||
} | ||
|
||
body { | ||
margin: 0; | ||
font-family: -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; | ||
} | ||
|
||
code { | ||
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; | ||
font-size: 87.5%; | ||
color: #e83e8c; | ||
word-break: break-word; | ||
} | ||
|
||
.left-column { | ||
padding: .75rem; | ||
max-width: 75%; | ||
min-width: 55%; | ||
} | ||
|
||
.right-column { | ||
padding: .75rem; | ||
max-width: 25%; | ||
} | ||
|
||
.container { | ||
display: flex; | ||
width: 100%; | ||
} | ||
|
||
li { | ||
margin: 0.75rem; | ||
} | ||
|
||
.right-section { | ||
margin-left: 1rem; | ||
padding-left: 0.5rem; | ||
} | ||
|
||
.right-section h3 { | ||
padding-top: 0; | ||
font-weight: 200; | ||
} | ||
|
||
.right-section ul { | ||
border-left: 0.3rem solid #00A1E2; | ||
list-style-type: none; | ||
padding-left: 0; | ||
} | ||
|
||
</style> | ||
</head> | ||
<body> | ||
|
||
<div class="banner lead"> | ||
Your new Cloud-Native app is ready! | ||
</div> | ||
|
||
<div class="container"> | ||
<div class="left-column"> | ||
<p class="lead"> Congratulations, you have created a new Quarkus application.</p> | ||
|
||
<h2>Why do you see this?</h2> | ||
|
||
<p>This page is served by Quarkus. The source is in | ||
<code>src/main/resources/META-INF/resources/index.html</code>.</p> | ||
|
||
<h2>What can I do from here?</h2> | ||
|
||
<p>If not already done, run the application in <em>dev mode</em> using: <code>mvn compile quarkus:dev</code>. | ||
</p> | ||
<ul> | ||
<li>Add REST resources, Servlets, functions and other services in <code>src/main/java</code>.</li> | ||
<li>Your static assets are located in <code>src/main/resources/META-INF/resources</code>.</li> | ||
<li>Configure your application in <code>src/main/resources/META-INF/microprofile-config.properties</code>. | ||
</li> | ||
</ul> | ||
|
||
<h2>Do you like Quarkus?</h2> | ||
<p>Go give it a star on <a href="https://github.com/quarkusio/quarkus">GitHub</a>.</p> | ||
|
||
<h2>How do I get rid of this page?</h2> | ||
<p>Just delete the <code>src/main/resources/META-INF/resources/index.html</code> file.</p> | ||
</div> | ||
<div class="right-column"> | ||
<div class="right-section"> | ||
<h3>Application</h3> | ||
<ul> | ||
<li>GroupId: org.acme</li> | ||
<li>ArtifactId: getting-started</li> | ||
<li>Version: 1.0-SNAPSHOT</li> | ||
</ul> | ||
</div> | ||
<div class="right-section"> | ||
<h3>Next steps</h3> | ||
<ul> | ||
<li><a href="https://quarkus.io/guides/maven-tooling">Setup your IDE</a></li> | ||
<li><a href="https://quarkus.io/guides/getting-started">Getting started</a></li> | ||
<li><a href="https://quarkus.io">Quarkus Web Site</a></li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
</body> | ||
</html> |
1 change: 1 addition & 0 deletions
1
.../test/resources-filtered/projects/test-template/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
quarkus.test.continuous-testing=enabled |
23 changes: 23 additions & 0 deletions
23
.../test/resources-filtered/projects/test-template/src/test/java/com/acme/TemplatedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.acme; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.hamcrest.CoreMatchers.is; | ||
|
||
import org.junit.jupiter.api.TestTemplate; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
import io.quarkus.test.junit.QuarkusTest; | ||
|
||
@QuarkusTest | ||
public class TemplatedTest { | ||
|
||
@TestTemplate | ||
@ExtendWith(UserIdGeneratorTestInvocationContextProvider.class) | ||
public void testHelloEndpoint(UserIdGeneratorTestCase testCase) { | ||
given() | ||
.when().get("/hello") | ||
.then() | ||
.statusCode(200) | ||
.body(is(testCase.getExpectedBody())); | ||
} | ||
} |
Oops, something went wrong.