Skip to content

Null values now pass in "notInstance" checks - #4412

Open
kqarryzada wants to merge 1 commit into
assertj:mainfrom
kqarryzada:main
Open

kqarryzada wants to merge 1 commit into
assertj:mainfrom
kqarryzada:main

Conversation

@kqarryzada

Copy link
Copy Markdown

Updated the implementation of methods such as Objects.isNotInstanceOf() to pass when the 'actual' value is null. This is intended to align with the way Java treats the 'instanceof' keyword.

Check List:

Following the contributing guidelines will make it easier for us to review and accept your PR.

.withMessage(actualIsNull());
void should_throw_error_if_type_is_null() {
assertThatNullPointerException().isThrownBy(() -> objects.assertIsNotExactlyInstanceOf(someInfo(), "Yoda", null))
.withMessage("The given type should not be null");

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diff looks strange for these because I left "should_pass" tests above the "should_throw" ones, but I didn't modify any "should_throw" tests.

Updated the implementation of methods such as Objects.isNotInstanceOf()
to pass when the 'actual' value is null. This is intended to align with
the way Java treats the 'instanceof' keyword.

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

Avoid failures in isNotInstanceOf assertions for null objects

1 participant