-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1022 from hcoles/feature/non-delegating-classload…
…er-test-support support quarkus test runner
- Loading branch information
Showing
15 changed files
with
396 additions
and
15 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
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
116 changes: 116 additions & 0 deletions
116
pitest-maven-verification/src/test/resources/pit-quarkus/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,116 @@ | ||
<?xml version="1.0"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.example</groupId> | ||
<artifactId>pitest-quarlus</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<properties> | ||
<compiler-plugin.version>3.8.1</compiler-plugin.version> | ||
<failsafe.useModulePath>false</failsafe.useModulePath> | ||
<maven.compiler.release>11</maven.compiler.release> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id> | ||
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id> | ||
<quarkus.platform.version>2.8.3.Final</quarkus.platform.version> | ||
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version> | ||
<pitest.junit5.version>0.14</pitest.junit5.version> | ||
</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-reactive</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5-mockito</artifactId> | ||
<version>2.8.1.Final</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-resteasy-reactive-jackson</artifactId> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>${quarkus.platform.group-id}</groupId> | ||
<artifactId>quarkus-maven-plugin</artifactId> | ||
<version>${quarkus.platform.version}</version> | ||
<extensions>true</extensions> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build</goal> | ||
<goal>generate-code</goal> | ||
<goal>generate-code-tests</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>${compiler-plugin.version}</version> | ||
<configuration> | ||
<compilerArgs> | ||
<arg>-parameters</arg> | ||
</compilerArgs> | ||
</configuration> | ||
</plugin> | ||
<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>org.pitest</groupId> | ||
<artifactId>pitest-maven</artifactId> | ||
<version>${pit.version}</version> | ||
<configuration> | ||
<timeoutConstant>10000</timeoutConstant> | ||
<exportLineCoverage>true</exportLineCoverage> | ||
<outputFormats><value>XML</value></outputFormats> | ||
<timestampedReports>false</timestampedReports> | ||
<verbose>true</verbose> | ||
</configuration> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.pitest</groupId> | ||
<artifactId>pitest-junit5-plugin</artifactId> | ||
<version>${pitest.junit5.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</plugin> | ||
|
||
</plugins> | ||
</build> | ||
</project> |
23 changes: 23 additions & 0 deletions
23
...rc/test/resources/pit-quarkus/src/main/java/com/example/controller/ExampleController.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.example.controller; | ||
|
||
import com.example.service.ExampleService; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
import javax.inject.Inject; | ||
import javax.ws.rs.*; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
@Path("/example") | ||
@ApplicationScoped | ||
public class ExampleController { | ||
@Inject | ||
ExampleService service; | ||
|
||
@POST | ||
@Consumes(MediaType.APPLICATION_JSON) | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public boolean doStuff(String s) { | ||
System.out.println("Won't die"); | ||
return service.doStuff(s); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...tion/src/test/resources/pit-quarkus/src/main/java/com/example/service/ExampleService.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,13 @@ | ||
package com.example.service; | ||
|
||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
|
||
@ApplicationScoped | ||
public class ExampleService { | ||
|
||
public boolean doStuff(String s) { | ||
return s.equals("foo"); | ||
} | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
...ven-verification/src/test/resources/pit-quarkus/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.rest-client."org.acme.rest.client.ExtensionsService".scope=javax.inject.ApplicationScoped # |
37 changes: 37 additions & 0 deletions
37
...ation/src/test/resources/pit-quarkus/src/test/java/com/example/ExampleControllerTest.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,37 @@ | ||
package com.example; | ||
|
||
import com.example.controller.ExampleController; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
import org.junit.jupiter.api.Test; | ||
import org.mockito.Mockito; | ||
import com.example.service.ExampleService; | ||
|
||
import javax.inject.Inject; | ||
import io.quarkus.test.junit.mockito.InjectMock; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static org.mockito.ArgumentMatchers.anyString; | ||
|
||
@QuarkusTest | ||
public class ExampleControllerTest { | ||
@Inject | ||
ExampleController controller; | ||
|
||
@InjectMock | ||
ExampleService service; | ||
|
||
@Test | ||
void doTrue() { | ||
Mockito.when(service.doStuff(anyString())).thenReturn(true); | ||
assertTrue(controller.doStuff("s")); | ||
} | ||
|
||
@Test | ||
void doFalse() { | ||
Mockito.when(service.doStuff(anyString())).thenReturn(false); | ||
assertFalse(controller.doStuff("s")); | ||
} | ||
|
||
|
||
} |
27 changes: 27 additions & 0 deletions
27
...fication/src/test/resources/pit-quarkus/src/test/java/com/example/ExampleServiceTest.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,27 @@ | ||
package com.example; | ||
|
||
import io.quarkus.test.junit.QuarkusTest; | ||
import com.example.service.ExampleService; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import javax.inject.Inject; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
@QuarkusTest | ||
public class ExampleServiceTest { | ||
@Inject | ||
ExampleService service; | ||
|
||
|
||
@Test | ||
void doTrue() { | ||
assertTrue(service.doStuff("foo")); | ||
} | ||
|
||
@Test | ||
void doFalse() { | ||
assertFalse(service.doStuff("notfoo")); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...ven-verification/src/test/resources/pit-quarkus/src/test/java/com/example/NormalTest.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,13 @@ | ||
package com.example; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
class NormalTest { | ||
|
||
@Test | ||
void dd() { | ||
long pid = ProcessHandle.current().pid(); | ||
System.out.println("!!!!!!!!!!!!! " + pid); | ||
} | ||
|
||
} |
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
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
Oops, something went wrong.