jdiazcano / cfg4k

Flexible and easy to use config library written in kotlin
Apache License 2.0
80 stars 6 forks source link

`ConfigProviderTest` has no test for `nested.a` #30

Closed rocketraman closed 6 years ago

rocketraman commented 6 years ago

The ConfigProviderTest has no test for nested.a.

jdiazcano commented 6 years ago

Is this a bug or just for more coverage?

I'm right now on a trip and I'll be back next week! I'll try to do it asap

jdiazcano commented 6 years ago

Have in mind that there is a specific class for nesting even though I'm thinking in merging both.

rocketraman commented 6 years ago

Well... here is my situation. I tried to create a (hocon) config like this:

a.b.c = something

And then I tried to reference it in the code like this:

configProvider.bind<B>("a.b")

where B looks like:

interface B {
  fun c(): String
}

which didn't work. So I was looking for unit tests to see if this was a) a syntax error on my part, or b) something that isn't even supported. I didn't find any tests for this case.

FWIW, I do it this way in cfg4j.

jdiazcano commented 6 years ago

I'll investigate

jdiazcano commented 6 years ago

@rocketraman what provider are you using? If possible could you paste a snippet to reproduce?

in ProviderWithHocon.kt i've added a loader and a proxy provider

val deployment = provider.bind<KtorDeploymentConfig>("ktor.deployment")
deployment.port.should.be.equal(8080)

And it works

rocketraman commented 6 years ago

@jdiazcano What do you know... I just tried it again and it worked perfectly. I'll close. Thanks!

jdiazcano commented 6 years ago

I am still merging the changes for the tests.