Skip to content

Commit

Permalink
Merge branch 'main' into bump/mockk-1.13.2
Browse files Browse the repository at this point in the history
  • Loading branch information
glefloch authored Aug 28, 2023
2 parents 8053e91 + 8751027 commit e83eb7e
Show file tree
Hide file tree
Showing 19 changed files with 47 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .github/project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Quarkiverse Mockk Extension
release:
current-version: 1.1.1
next-version: 1.2.0-SNAPSHOT
current-version: 2.1.0
next-version: 2.2.0-SNAPSHOT

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ dependencies {

## Compatibility with Quarkus

Starting with Quarkus `2.8` and above, version `1.1.0` of `quarkus-junit5-mockk` should be used.
Starting with version ˋ3+`, version `2.0.0` of `quarkus-junit5-mockk` should be used.
If you use a version between `2.8` and before `3.0.0`, version `1.1.0` of `quarkus-junit5-mockk` should be used.
If you use a version before `2.7`, version `1.0.1` of `quarkus-junit5-mockk` should be used.

## Example
Expand Down
2 changes: 1 addition & 1 deletion docs/antora.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: quarkus-mockk
title: Quarkus Mockk
title: Mockk
version: dev
nav:
- modules/ROOT/nav.adoc
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/injectmock.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This annotation allows you to inject MockK mocks in your application.
This annotation has three parameters:

* `relaxed`, if set to `true`, all function will return simple values. Default to `false`.
* `relacUnitFun`, if set to `true`, `Unit` function will be relaxed. Default to `false`.
* `relaxUnitFun`, if set to `true`, `Unit` function will be relaxed. Default to `false`.
* `convertScopes`, it set to `true`, convert the `@Singleton` scope of bean to `@ApplicationScoped`. This allows to mock singleton beans
== Example
Expand Down Expand Up @@ -58,4 +58,4 @@ class InjectionMockTest {
assertThat(firstService.greet()).isEqualTo("test")
}
}
----
----
2 changes: 1 addition & 1 deletion integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.quarkiverse.mockk</groupId>
<artifactId>quarkus-junit5-mockk-parent</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>2.2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.acme

import javax.enterprise.context.ApplicationScoped
import jakarta.enterprise.context.ApplicationScoped

@ApplicationScoped
class MessageService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.acme

import javax.inject.Singleton
import jakarta.inject.Singleton

@Singleton
open class SingletonService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.acme

import javax.enterprise.context.ApplicationScoped
import jakarta.enterprise.context.ApplicationScoped

@ApplicationScoped
class SuffixService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package org.acme.resource

import org.acme.MessageService
import org.acme.SuffixService
import javax.ws.rs.GET
import javax.ws.rs.Path
import jakarta.ws.rs.GET
import jakarta.ws.rs.Path

@Path("/message")
class RestRessource(val messageService: MessageService, val suffixService: SuffixService) {
Expand Down
2 changes: 1 addition & 1 deletion junit5-mockk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.quarkiverse.mockk</groupId>
<artifactId>quarkus-junit5-mockk-parent</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>2.2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.quarkiverse.test.junit.mockk.internal

import io.mockk.spyk
import io.quarkiverse.test.junit.mockk.InjectSpy
import io.quarkus.arc.runtime.ClientProxyUnwrapper
import io.quarkus.arc.ClientProxy
import io.quarkus.test.junit.callback.QuarkusTestAfterConstructCallback
import java.lang.reflect.Field

Expand All @@ -24,11 +24,10 @@ class CreateMockkSpiesCallback: QuarkusTestAfterConstructCallback {
}

private fun createSpyAndSetTestField(testInstance: Any, field: Field, beanInstance: Any): Any {
val unwrapper = ClientProxyUnwrapper()
val spy = spyk(unwrapper.apply(beanInstance))
val spy = spyk(ClientProxy.unwrap(beanInstance))
if (field.trySetAccessible()) {
field.set(testInstance, spy)
}
return spy
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import io.quarkiverse.test.junit.mockk.InjectSpy
import io.quarkus.arc.Arc
import java.lang.IllegalStateException
import java.lang.reflect.Field
import javax.inject.Qualifier
import jakarta.inject.Qualifier

object ReflectionUtils {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.quarkiverse.test.junit.mockk.internal.application

import javax.inject.Singleton
import jakarta.inject.Singleton

@Singleton
open class SimpleSingletonBean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import io.mockk.verify
import io.quarkiverse.test.junit.mockk.InjectMock
import io.quarkus.test.junit.QuarkusTest
import org.junit.jupiter.api.Test
import javax.enterprise.context.ApplicationScoped
import javax.inject.Inject
import jakarta.enterprise.context.ApplicationScoped
import jakarta.inject.Inject

@QuarkusTest
class InjectRelaxedMockTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient
import org.eclipse.microprofile.rest.client.inject.RestClient
import org.jboss.resteasy.annotations.jaxrs.PathParam
import org.junit.jupiter.api.Test
import javax.enterprise.context.ApplicationScoped
import javax.inject.Inject
import javax.ws.rs.GET
import javax.ws.rs.Path
import javax.ws.rs.Produces
import javax.ws.rs.core.MediaType
import jakarta.enterprise.context.ApplicationScoped
import jakarta.inject.Inject
import jakarta.ws.rs.GET
import jakarta.ws.rs.Path
import jakarta.ws.rs.Produces
import jakarta.ws.rs.core.MediaType

@QuarkusTest
class InjectRestClientTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import io.quarkiverse.test.junit.mockk.InjectMock
import io.quarkus.test.junit.QuarkusTest
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import javax.enterprise.context.ApplicationScoped
import javax.inject.Inject
import jakarta.enterprise.context.ApplicationScoped
import jakarta.inject.Inject

@QuarkusTest
class InjectionMockTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import io.quarkiverse.test.junit.mockk.InjectSpy
import io.quarkus.test.junit.QuarkusTest
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import javax.enterprise.context.ApplicationScoped
import javax.inject.Inject
import jakarta.enterprise.context.ApplicationScoped
import jakarta.inject.Inject

@QuarkusTest
class InjectionSpyTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import io.quarkus.test.junit.QuarkusTest
import io.smallrye.mutiny.Uni
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import javax.enterprise.context.ApplicationScoped
import jakarta.enterprise.context.ApplicationScoped

@QuarkusTest
class ReturnMutinyTypeTest {
Expand Down
24 changes: 15 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,34 @@
<parent>
<groupId>io.quarkiverse</groupId>
<artifactId>quarkiverse-parent</artifactId>
<version>10</version>
<version>15</version>
</parent>

<groupId>io.quarkiverse.mockk</groupId>
<artifactId>quarkus-junit5-mockk-parent</artifactId>
<packaging>pom</packaging>
<version>1.2.0-SNAPSHOT</version>
<version>2.2.0-SNAPSHOT</version>
<name>Quarkus - JUnit 5 - Mockk Parent</name>

<properties>
<kotlin.version>1.7.21</kotlin.version>
<mockk.version>1.13.2</mockk.version>

<quarkus.version>2.14.0.Final</quarkus.version>
<dokka.version>1.7.20</dokka.version>
<assertj.version>3.23.1</assertj.version>
<kotlin.version>1.9.10</kotlin.version>
<mockk.version>1.13.7</mockk.version>
<quarkus.version>3.3.0</quarkus.version>
<dokka.version>1.8.20</dokka.version>
<assertj.version>3.24.2</assertj.version>

<!-- This plugin is not compatible with kotlin -->
<maven.javadoc.skip>true</maven.javadoc.skip>
<kotlin.compiler.jvmTarget>11</kotlin.compiler.jvmTarget>
</properties>

<scm>
<connection>scm:git:[email protected]:quarkiverse/quarkus-mockk.git</connection>
<developerConnection>scm:git:[email protected]:quarkiverse/quarkus-mockk.git</developerConnection>
<url>https://github.com/quarkiverse/quarkus-mockk</url>
<tag>HEAD</tag>
</scm>

<dependencyManagement>
<dependencies>
<dependency>
Expand Down Expand Up @@ -57,4 +63,4 @@
</modules>
</profile>
</profiles>
</project>
</project>

0 comments on commit e83eb7e

Please sign in to comment.