Marko Kunic
11/24/2021, 12:08 PMwithApplication(testEnv)
it doesn't load my module that is defined in application.conf
but when I do withTestApplication(Application::main)
it loads the module but the configuration is missing, not sure what am I doing wrong here?Aleksei Tirman [JB]
11/24/2021, 12:32 PMapplication.conf
file is located?Marko Kunic
11/24/2021, 12:32 PMmain/resources
Aleksei Tirman [JB]
11/24/2021, 12:32 PMMarko Kunic
11/24/2021, 12:33 PMmain
config file and change in test what I want?Marko Kunic
11/24/2021, 12:40 PMapplication.conf
from main resources without a problemAleksei Tirman [JB]
11/24/2021, 12:43 PMConfigFactory.parseFile(File("/path/to/file")
code to load a config from local filesystem.Marko Kunic
11/24/2021, 12:43 PMConfigFactory.load("application.conf")
just fine, it loads the config file from main/resources
the issue is that it doesn't start he module specified in that configAleksei Tirman [JB]
11/24/2021, 12:49 PMAleksei Tirman [JB]
11/24/2021, 12:51 PMMarko Kunic
11/24/2021, 1:00 PMAleksei Tirman [JB]
11/24/2021, 1:04 PMMarko Kunic
11/24/2021, 1:06 PM@Test
fun `test something`() {
withApplication(createTestEnvironment { HoconApplicationConfig(ConfigFactory.load("application.conf")) }) {
with(
handleRequest(<http://HttpMethod.Post|HttpMethod.Post>, "my/endpoint") {
addHeader(HttpHeaders.ContentType, ContentType.Application.Json.contentType)
setBody("")
}
) {
assertEquals(HttpStatusCode.OK, response.status())
}
}
}
Aleksei Tirman [JB]
11/24/2021, 1:11 PMconfig
property to make it work. So before HoconApplicationConfig(
add config =
Marko Kunic
11/24/2021, 1:12 PM