Skip to content

Commit

Permalink
work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
khalilou88 committed Dec 28, 2023
1 parent fa87e3b commit 6d64948
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ node_modules

# IDEs and editors
.idea
*.iml
.project
.classpath
.c9/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.example.micronaut.micronautktapp

import io.micronaut.runtime.Micronaut.run

fun main(args: Array<String>) {
run(*args)
run(*args)
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import io.micronaut.http.annotation.Produces
import jakarta.inject.Inject

@Controller("/hello")
class HelloController(@Inject val helloService: HelloService) {

@Get
@Produces(MediaType.TEXT_PLAIN)
fun index() = helloService.greeting()
class HelloController(
@Inject val helloService: HelloService,
) {
@Get
@Produces(MediaType.TEXT_PLAIN)
fun index() = helloService.greeting()
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertNotNull
import org.junit.jupiter.api.Test

@MicronautTest
class HelloControllerTest(@Client("/") val client: HttpClient) {

@Test
fun testHello() {
val request: HttpRequest<Any> = HttpRequest.GET("/hello")
val body = client.toBlocking().retrieve(request)
assertNotNull(body)
assertEquals("Hello World", body)
}
}
@MicronautTest
class HelloControllerTest(
@Client("/") val client: HttpClient,
) {
@Test
fun testHello() {
val request: HttpRequest<Any> = HttpRequest.GET("/hello")
val body = client.toBlocking().retrieve(request)
assertNotNull(body)
assertEquals("Hello World", body)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@ package com.example.micronaut.micronautktapp

import io.micronaut.runtime.EmbeddedApplication
import io.micronaut.test.extensions.junit5.annotation.MicronautTest
import jakarta.inject.Inject
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import jakarta.inject.Inject

@MicronautTest
class MicronautMicronautKtAppTest {
@Inject
lateinit var application: EmbeddedApplication<*>

@Inject
lateinit var application: EmbeddedApplication<*>

@Test
fun testItWorks() {
Assertions.assertTrue(application.isRunning)
}

@Test
fun testItWorks() {
Assertions.assertTrue(application.isRunning)
}
}

0 comments on commit 6d64948

Please sign in to comment.