Paul at Avans Breda
07/18/2024, 5:59 PMCould not resolve all files for configuration ':testCompileClasspath'.> Could not find io.ktorktor server test base3.0.0-beta-2. Searched in the following locations: - https://repo.maven.apache.org/maven2/io/ktor/ktor-server-test-base/3.0.0-beta-2/ktor-server-test-base-3.0.0-beta-2.pom Required by: project : > io.ktorktor server tests jvm3.0.0-beta-2 Possible solution: - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html Any suggestions? Thanks!
Aleksei Tirman [JB]
07/18/2024, 6:34 PMio.ktor:ktor-server-tests-jvm
artifact with io.ktor:ktor-server-test-host
in the Gradle build configuration:
testImplementation("io.ktor:ktor-server-test-host")
Paul at Avans Breda
07/18/2024, 6:59 PM<http://localhost/tasks/byPriority/Medium>
Response status 404 Not Found
Response header ContentType: null
Request header Accept: */*
You can read how to resolve NoTransformationFoundException at FAQ:
https://ktor.io/docs/faq.html#no-transformation-found-exception
io.ktor.client.call.NoTransformationFoundException: Expected response body of the type 'class kotlin.collections.List' but was 'class io.ktor.utils.io.SourceByteReadChannel'
In response from <http://localhost/tasks/byPriority/Medium>
Response status 404 Not Found
Response header ContentType: null
Request header Accept: */*
Aleksei Tirman [JB]
07/18/2024, 7:22 PMPaul at Avans Breda
07/18/2024, 7:57 PMfun Application.configureSerialization() {
install(ContentNegotiation) {
json()
}
routing {
get("/json/kotlinx-serialization") {
call.respond(mapOf("hello" to "world"))
}
}
}
But for ApplicationTest.kt it fails to recognize install using the same imports:
class ApplicationTest {
@Test
fun tasksCanBeFoundByPriority() = testApplication {
val client = createClient {
testApplication.install(ContentNegotiation) {
json()
}
}
}
(I used the IntelliJ Ultimate Ktor plugin to generate the project with ContentNegotiation plugin. Maybe this project template is not updated for the latest Ktor version)Aleksei Tirman [JB]
07/18/2024, 8:37 PM@Test
fun tasksCanBeFoundByPriority() = testApplication {
val client = createClient {
install(io.ktor.client.plugins.contentnegotiation.ContentNegotiation) {
json()
}
}
}
Paul at Avans Breda
07/19/2024, 2:17 PMapplication { module() }