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 · 10 comments · May be fixed by #1102
Open

Implement InnerSpec Kotlin DSL #981

seongahjo opened this issue May 23, 2024 · 10 comments · May be fixed by #1102
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. 😢

@soonhong99
Copy link

@eunbileeme @seongahjo

any updates?

@seongahjo
Copy link
Contributor Author

@soonhong99
Sadly, it seems there is no update for now.

Perhaps someone else can resolve with this.

@soonhong99
Copy link

@soonhong99 Sadly, it seems there is no update for now.

Perhaps someone else can resolve with this.

Then can I resolve this issue?

@seongahjo
Copy link
Contributor Author

@soonhong99
Sure, thank you!

@soonhong99 soonhong99 linked a pull request Nov 21, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants