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

Using Kotlin guide test fail #21755

Closed
Rooarii opened this issue Nov 27, 2021 · 0 comments · Fixed by #21764
Closed

Using Kotlin guide test fail #21755

Rooarii opened this issue Nov 27, 2021 · 0 comments · Fixed by #21764
Labels
kind/bug Something isn't working
Milestone

Comments

@Rooarii
Copy link

Rooarii commented Nov 27, 2021

Describe the bug

I followed the Using Kotlin as described, and i to run the GreetingTest with mvn test.

Expected behavior

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.2 s - in org.acme.rest.GreetingResourceTest

Actual behavior

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.807 s
[INFO] Finished at: 2021-11-27T22:10:08+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.5.31:test-compile (test-compile) on project rest-kotlin-quickstart: Compilation failure
[ERROR] /Desktop/rest-kotlin-quickstart/src/test/kotlin/org/acme/rest/GreetingResourceTest.kt:[17,31] Unresolved reference: equalTo
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

How to Reproduce?

Reproducer:

  1. Run
mvn io.quarkus.platform:quarkus-maven-plugin:2.5.0.Final:create \
    -DprojectGroupId=org.acme \
    -DprojectArtifactId=rest-kotlin-quickstart \
    -DclassName="org.acme.rest.GreetingResource" \
    -Dpath="/greeting" \
    -Dextensions="resteasy,kotlin,resteasy-jackson"
cd rest-kotlin-quickstart
  1. Update the code as describbed in https://quarkus.io/guides/kotlin
  2. run mvn test

Output of uname -a or ver

Linux Precision-3551 5.11.0-40-generic #44~20.04.2-Ubuntu SMP Tue Oct 26 18:07:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk 11.0.12 2021-07-20 OpenJDK Runtime Environment 18.9 (build 11.0.12+7) OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7, mixed mode)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.5.0

Build tool (ie. output of mvnw --version or gradlew --version)

3.8.3

Additional information

Test is failling with mvn test command, nevertheless when when we run mvn quarkus:dev`, GreetingTest fails the first time ans it passes when you hit the [r] to re-run the test.

Furhtermore, to make the the test pass with the mvn test command the following code works:

package org.acme.rest

import io.quarkus.test.junit.QuarkusTest
import io.restassured.RestAssured.given
import org.hamcrest.CoreMatchers.`is`
import org.junit.jupiter.api.Test

@QuarkusTest
class GreetingResourceTest {

    @Test
    fun testHelloEndpoint() {
        given()
          .`when`().get("/greeting")
          .then()
             .statusCode(200)
             .body(`is`("{\"message\":\"hello\"}"))
    }

}
@Rooarii Rooarii added the kind/bug Something isn't working label Nov 27, 2021
stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Nov 29, 2021
This makes it clear where the 'equalTo' method is coming from.

Fixes quarkusio#21755
@quarkus-bot quarkus-bot bot added this to the 2.6 - main milestone Nov 29, 2021
@gsmet gsmet modified the milestones: 2.6 - main, 2.5.1.Final Nov 29, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Nov 29, 2021
This makes it clear where the 'equalTo' method is coming from.

Fixes quarkusio#21755

(cherry picked from commit d8e2773)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants