-
Notifications
You must be signed in to change notification settings - Fork 321
Closed
Description
NullAway recognizes the assertThat(...).isNotNull() (#301), but fails to recognize if the description is added. Please refer to the example below. NullAway version is 0.10.18.
package com.example;
import static org.assertj.core.api.Assertions.assertThat;
import jakarta.annotation.Nullable;
import org.junit.jupiter.api.Test;
public class NullAwayTest {
@Test
void assertNotNull() {
String s = getString();
assertThat(s).isNotNull();
assertThat(s.length()).isEqualTo(0); // NullAway doesn't complain, this is correct
}
@Test
void assertNotNullAs() {
String s = getString();
assertThat(s).as("text").isNotNull();
assertThat(s.length()).isEqualTo(0); // NullAway complains, this is wrong
}
@Test
void assertNotNullDescribedAs() {
String s = getString();
assertThat(s).describedAs("text").isNotNull();
assertThat(s.length()).isEqualTo(0); // NullAway complains, this is wrong
}
static @Nullable String getString() {
return null;
}
}Metadata
Metadata
Assignees
Labels
No labels