<file_sep>package com.leanmentors.goals

import com.leanmentors.goals.controllers.TaskController
import com.leanmentors.goals.data.Tasks
import org.junit.jupiter.api.Test
import reactor.test.StepVerifier
import java.time.LocalDate

class TaskServiceTest {
    @Test
    fun testController() {
        StepVerifier.create(TaskController().createTasks())
                .expectNext(Tasks("Create Project", "Create Project Today", LocalDate.parse("2020-10-05"), LocalDate.parse("2020-10-05")))
                .verifyComplete()
    }

}<file_sep>package com.leanmentors.goals

import com.leanmentors.goals.controllers.TaskController
import com.leanmentors.goals.data.Tasks
import io.micronaut.http.HttpRequest
import io.micronaut.http.HttpResponse
import io.micronaut.http.client.annotation.Client
import io.micronaut.reactor.http.client.ReactorHttpClient
import io.micronaut.runtime.server.EmbeddedServer
import io.micronaut.test.extensions.junit5.annotation.MicronautTest
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import reactor.core.publisher.Flux
import reactor.test.StepVerifier
import java.util.*
import javax.inject.Inject
import kotlin.reflect.jvm.internal.impl.metadata.ProtoBuf

@MicronautTest
class TaskServiceIntTest {

    @Inject
    lateinit var server: EmbeddedServer

    @Inject
    @field:Client("/")
    lateinit var client: ReactorHttpClient


    @Test
    fun testHelloWorldResponse() {
        val response: Flux<HttpResponse<Tasks>>? = client.exchange("/tasks", Tasks::class.java)
        response?.map { it.body() }?.count()
     }
}


<file_sep>plugins {
    id "org.jetbrains.kotlin.jvm" version "1.4.10"
    id "org.jetbrains.kotlin.kapt" version "1.4.10"
    id "org.jetbrains.kotlin.plugin.allopen" version "1.4.10"
    id "com.github.johnrengelman.shadow" version "6.0.0"
    id "io.micronaut.application" version '1.0.5'
}

version "0.1"
group "com.example"

repositories {
    mavenCentral()
    jcenter()
}

micronaut {
    runtime "netty"
    testRuntime "junit5"
    processing {
        incremental true
        annotations "com.example.*"
    }
}

dependencies {
    implementation("io.micronaut:micronaut-validation")
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}")
    implementation("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
    implementation("io.micronaut.kotlin:micronaut-kotlin-runtime")
    implementation("io.micronaut:micronaut-runtime")
    implementation("io.micronaut:micronaut-http-client")
    implementation("io.micronaut.netflix:micronaut-netflix-hystrix")
    implementation("io.micronaut.beanvalidation:micronaut-hibernate-validator")
    implementation("io.micronaut.mongodb:micronaut-mongo-reactive")
    implementation("io.micronaut.reactor:micronaut-reactor")
    runtimeOnly("ch.qos.logback:logback-classic")
    runtimeOnly("com.fasterxml.jackson.module:jackson-module-kotlin")
    annotationProcessor("io.micronaut:micronaut-inject-java:2.1.3") // <2>
    implementation("io.micronaut:micronaut-inject:2.1.3")

    testAnnotationProcessor("io.micronaut:micronaut-inject-java:2.1.3")
    testImplementation("de.flapdoodle.embed:de.flapdoodle.embed.mongo:2.0.1")
    testImplementation("io.micronaut.reactor:micronaut-reactor-http-client:1.0.0")
    testImplementation("io.projectreactor:reactor-test:3.1.0.RELEASE")
}

mainClassName = "com.example.ApplicationKt"
java {
    sourceCompatibility = JavaVersion.toVersion('1.8')
}

compileKotlin {
    kotlinOptions {
        jvmTarget = '1.8'
    }
}
compileTestKotlin {
    kotlinOptions {
        jvmTarget = '1.8'
    }
}



<file_sep>package com.leanmentors.goals.data

import java.time.LocalDate

data class Tasks(val name: String,
                 val description: String,
                 val startDate: LocalDate,
                 val endDate: LocalDate)<file_sep>package com.leanmentors.goals.controllers

import com.leanmentors.goals.data.Tasks
import io.micronaut.http.MediaType
import io.micronaut.http.annotation.Controller
import io.micronaut.http.annotation.Get
import reactor.core.publisher.Flux
import java.time.LocalDate
import java.util.*

@Controller("/tasks")
class TaskController {
    @Get(produces = [MediaType.APPLICATION_JSON] )
    fun createTasks():Flux<Tasks>{
        return Flux.just(Tasks("Create Project", "Create Project Today", LocalDate.parse("2020-10-05"), LocalDate.parse("2020-10-05")))
    }

}