Hi In our project we have multiple json file in a ...
# kotest
j
Hi In our project we have multiple json file in a tests resources folder we would like to deserialize during the tests Is there a Kotes framework that help doing that ? I found a way to read a specific file with a specific name but since we have many and we can add more - I would like to iterate over the folder (not nested) Thanks
s
You would just use jackson or some other json parser right?
j
yes
s
So does that answer your question
j
My question was more on how to collect all the files in a specific resource folder to parse laster by the jackson framework
I saw in TornadoFX they got some nice utils for that so I was wondering if there is one in kotest as well
s
Can you show me the tornado stuff
j
https://edvin.gitbooks.io/tornadofx-guide/content/part1/3_Components.html they added this:
Copy code
val resources: ResourceLookup by lazy {
    ResourceLookup(this)
}
so we can do something like this:
Copy code
val myJsonObject = resources.json("myobject.json")
in the page I sent under: Accessing Resources section
s
I see, that's not built into Kotest. I think its a little too specific to live in kotest, which doesn't have anything specific for json handling. You would be doing something like (in jackson)
mapper.readValue<Foo>(javaClass.getResourceAsStream("/myobject.json"))
I think you could add your own little wrapper very easily
j
ok tnx a lot