Skip to content

Feature: Generate fluent continuations to Asserts on properties #220

Description

@reitzig

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions