Skip to content

Latest commit

 

History

History
51 lines (37 loc) · 1.85 KB

README.md

File metadata and controls

51 lines (37 loc) · 1.85 KB

Java CI with Gradle Pure Kotlin

Quarkus Kotlin app with tests using Junit 5 and MockK

Sample of a simple Quarkus application written in Kotlin. Shows how Junit 5 and MockK may be used for mocking CDI beans.

Note: A detailed blog post where the motivation and whole set up is described can be found here: https://www.novatec-gmbh.de/blog/testing-quarkus-with-kotlin-junit-and-mockk

Scenario

Scenario

Running and packaging the application

Running the application in dev mode

You can run your application in dev mode that enables live coding using:

./gradlew quarkusDev

Packaging and running the application

The application can be packaged using:

./gradlew build

It produces the quarkus-kotlin-mockk-1.0.0-SNAPSHOT-runner.jar file in the /build directory. Be aware that it’s not an über-jar as the dependencies are copied into the build/lib directory.

If you want to build an über-jar, execute the following command:

./gradlew build -Dquarkus.package.type=uber-jar

The application is now runnable using java -jar build/quarkus-kotlin-mockk-1.0.0-SNAPSHOT-runner.jar.

Executing the tests

The tests can be either executed by running the Gradle command

./gradlew clean test

Or directly as usual in the IDE, e.g. IntelliJ. E.g. Run > RestControllerTestsWithBeforeEach.kt etc.