Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement InnerSpec Kotlin DSL #981

Open
seongahjo opened this issue May 23, 2024 · 6 comments
Open

Implement InnerSpec Kotlin DSL #981

seongahjo opened this issue May 23, 2024 · 6 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@seongahjo
Copy link
Contributor

Describe the feature you request

InnerSpec now shadow the lambda parameter it if you use the nested InnerSpec.

class CustomObject(val value: String)

val actual = SUT.giveMeBuilder<Map<String, CustomObject>>()
          .setInner {
             it.size(1)
                    .entry("key") { v ->
                        v.property("value", "expected")
                    }
          }
          .sample()

You should specify the parameter as v if you want to customize the value of Map.
It is better to use Kotlin DSL for InnerSpec like below.

val actual = SUT.giveMeBuilder<Map<String, CustomObject>>()
          .setInner {
               size(1)
                entry("key") {
                        property("value", "expected")
                    }
          }
          .sample()

InstantiationDsl is a good reference.

   val actual = SUT.giveMeBuilder<Foo>()
            .instantiateBy {
                constructor<Foo> {
                    parameter<String>()
                    parameter<Int>()
                }
            }
            .sample()
            .bar

        then(actual).isNotNull
@seongahjo seongahjo added enhancement New feature or request good first issue Good for newcomers labels May 23, 2024
@eunbileeme
Copy link

eunbileeme commented May 29, 2024

Can I contribute this?

@seongahjo
Copy link
Contributor Author

@eunbileeme
Sure! Let me know if you have any questions.

@seongahjo
Copy link
Contributor Author

@eunbileeme
Hello, are there any updates?

@eunbileeme
Copy link

eunbileeme commented Jul 20, 2024

Hello.
Sorry, I was already mistaken that someone else solved it.

Is there a set period for the issue to close?

@seongahjo
Copy link
Contributor Author

@eunbileeme
No, no fixed deadline. But let me know if you do not have time to resolve this issue for other contributors. 😄

@eunbileeme
Copy link

eunbileeme commented Jul 20, 2024

@seongahjo
Checked it.
I will commit as soon as possible or share the schedule.

Once again, I'm sorry for the late confirmation. 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants