Sign in

AssertJ

@assertj.github.io
459 followers 4 following 29 posts

Fluent testing assertions for Java and the JVM

PostsRepliesMedia
AssertJ @assertj.github.io · 14/07/2025
The AssertJ Recursive Comparison might be a good candidate for your use case: assertj.github.io/doc/#assertj...
An AssertJ code snippet that demonstrates how the recursive comparison can be used to ignore fields of a specific type:

```
record Person(String name, Instant birthday) {}

@Test
void test() {
    var person1 = new Person("John", Instant.EPOCH);
    var person2 = new Person("John", Instant.now());
    
    assertThat(person1)
        .usingRecursiveComparison()
        .ignoringFieldsOfTypes(Instant.class)
        .isEqualTo(person2);
}
```
0182
AssertJ @assertj.github.io · 20/12/2024
`satisfies()` might be a good candidate for your use case: www.javadoc.io/doc/org.asse...
141
AssertJ @assertj.github.io · 21/11/2024
🍃 MockMvcTester 💚
251