marcinmoskala
03/18/2018, 11:07 AM@Test
fun testRequest() = withTestApplication(Application::main) {
with(handleRequest(HttpMethod.Get, "/")) {
assertEquals(HttpStatusCode.OK, response.status())
assertEquals("Test String", response.content)
}
with(handleRequest(HttpMethod.Get, "/index.html")) {
assertFalse(requestHandled)
}
}
All my other tests started failing:
java.lang.NoClassDefFoundError: Could not initialize class org.kotlinacademy.backend.Config
at usecase.UseCaseTest.cleanUpMocks(UseCaseTest.kt:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
...
Config
is an object:
https://github.com/MarcinMoskala/KotlinAcademyApp/blob/master/backend/src/org/kotlinacademy/backend/Config.kt
Here are all by tests:
https://github.com/MarcinMoskala/KotlinAcademyApp/tree/master/backend/test