Skip to content

[Bug]: DataResultAssert.extractingValue() annotated @NotNull but can wrap null #190

@Splatcrafter

Description

@Splatcrafter

AI REVIEWED

Module: testkit
File: testkit/assertion/DataResultAssert.java (~line 329)
Severity: Low

Summary

extractingValue() is annotated @NotNull but calls Assertions.assertThat(this.actual.result().orElse(null)), potentially wrapping null. While isSuccess() is called first, the @NotNull annotation on the return type is misleading.

Suggested Fix

Use orElseThrow():

return Assertions.assertThat(this.actual.result()
    .orElseThrow(() -> new AssertionError("Success result contained no value")));

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions