Hi, I'm struggling to migrate my microservices to ...
# ktor
h
Hi, I'm struggling to migrate my microservices to
ktor:3.0.0
. More specifically, I'm having problems migrating my
testApplication
tests. A simplified
pom.xml
for my services is
Copy code
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="<http://maven.apache.org/POM/4.0.0>" xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>"
         xsi:schemaLocation="<http://maven.apache.org/POM/4.0.0> <http://maven.apache.org/xsd/maven-4.0.0.xsd>">
    <modelVersion>4.0.0</modelVersion>

 
    <properties>      
        <ktor.version>3.0.0</ktor.version>      
        <junit-jupiter-api.version>5.11.3</junit-jupiter-api.version>
        <assertj-core.version>3.26.3</assertj-core.version>
    </properties>

    <dependencies>
       
        <dependency>
            <groupId>io.ktor</groupId>
            <artifactId>ktor-server-core-jvm</artifactId>
            <version>${ktor.version}</version>
        </dependency>
        <dependency>
            <groupId>io.ktor</groupId>
            <artifactId>ktor-server-netty-jvm</artifactId>
            <version>${ktor.version}</version>
        </dependency>
        <dependency>
            <groupId>io.ktor</groupId>
            <artifactId>ktor-server-metrics-jvm</artifactId>
            <version>${ktor.version}</version>
        </dependency>
        <dependency>
            <groupId>io.ktor</groupId>
            <artifactId>ktor-server-content-negotiation-jvm</artifactId>
            <version>${ktor.version}</version>
        </dependency>
        <dependency>
            <groupId>io.ktor</groupId>
            <artifactId>ktor-serialization-gson-jvm</artifactId>
            <version>${ktor.version}</version>
        </dependency>
      
        <!-- Testing -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit-jupiter-api.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.ktor</groupId>
            <artifactId>ktor-server-test-host-jvm</artifactId>
            <version>${ktor.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj-core.version}</version>
            <scope>test</scope>
        </dependency>
     
    </dependencies>
</project>
When I'm trying to run the first example from https://ktor.io/docs/server-testing.html I get an error where I can't find the
testApplication
. I thought the class/function should be a part of
ktor-server-test-host-jvm:3.0.0
?
And now it mysteriously works - it might be that my IntelliJ was buggy?
b
Yeah, I was gonna say it looks correct... sometimes a maven refresh is required when things don't resolve 🙁