assertj / assertj/assertj-generator

Feature: Generate fluent continuations to Asserts on properties

Open
#220 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
72
Forks
47
Avg merge
1d 16h
Merged PRs (30d)
2

Description

We would like to write something like:

```java
@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` otherwise.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.