You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package com.tejasoft.edu.calc.date.tests.bdd.ccbr;
import com.tejasoft.edu.calc.date.DateCalc;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import java.time.LocalDate;
import static org.junit.jupiter.api.Assertions.assertEquals;
public final class StepsDateCalc
{
private DateCalc dateCalc;
private String result;
@Given("^today is ([0-9]{4}-[0-9]{2}-[0-9]{2})$")
public void today_is(final LocalDate aNow)
{
dateCalc = new DateCalc(aNow);
}
@When("^I ask if ([0-9]{4}-[0-9]{2}-[0-9]{2}) is in the past$")
public void I_ask_if_date_is_in_the_past(final LocalDate aInputDate)
{
result = dateCalc.isDateInThePast(aInputDate);
}
@Then("^the result should be (yes|no)$")
public void the_result_should_be(final String aExpectedResult)
{
assertEquals(aExpectedResult, result);
}
}
it reports errors as
experiments\java\edu\src\main\java\com\tejasoft\edu\calc\date\tests\bdd\ccbr\StepsDateCalc.java:14: warning: [NullAway] @NonNull field dateCalc not initialized
private DateCalc dateCalc;
^
(see http://t.uber.com/nullaway )
experiments\java\edu\src\main\java\com\tejasoft\edu\calc\date\tests\bdd\ccbr\StepsDateCalc.java:15: warning: [NullAway] @NonNull field result not initialized
private String result;
^
(see http://t.uber.com/nullaway )
which is a wrong interpretation as these are the tests that have a lifecycle that way in x methods they are initialized and used in y method etc..
Maybe NullAway should know the framework-related meaning of initialization
The text was updated successfully, but these errors were encountered:
I haven't seen test code like this before. It seems like it might be a lot of work to support this framework and its semantics. You might be best off just not running NullAway on these tests.
nagkumar
changed the title
Nullaway wrongin reporting
Nullaway is wrong in reporting
Jul 21, 2023
for a BDD test like this
it reports errors as
which is a wrong interpretation as these are the tests that have a lifecycle that way in x methods they are initialized and used in y method etc..
Maybe NullAway should know the framework-related meaning of initialization
The text was updated successfully, but these errors were encountered: