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

Feature: Generate fluent continuations to Asserts on properties #220

Open
reitzig opened this issue Aug 2, 2024 · 0 comments
Open

Feature: Generate fluent continuations to Asserts on properties #220

reitzig opened this issue Aug 2, 2024 · 0 comments

Comments

@reitzig
Copy link

reitzig commented Aug 2, 2024

We would like to write something like:

@Data
class SomeClass {
    String id;
    OtherClass someField;
}

@Data
class OtherClass {
    String value;
}

@Test
void test() {
    SomeClass someObject = ...;
    assertThat(someObject)
        .hasName("foo")
        .someField()
            .hasValue("abc")
}

That is particularly useful when working on POJO trees as, for example, generated when parsing JSON/YAML documents.
(Inspired by ListAssert.singleElement().)

That is assuming, of course, that we generate the assertions for SomeClass.
The return type would be OtherClassAssert if we generate the assertions for that class as well, of ObjectAssert<OtherClass> otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant