How can I resolve this issue in IntellijIdea?
This answer Why no "field is never assigned" warning with @Mock only describe the reason but not offer the resolving.
How can I resolve this issue in IntellijIdea?
This answer Why no "field is never assigned" warning with @Mock only describe the reason but not offer the resolving.
This warning is produced by the "Unused declaration" inspection, which does not know about the @FindBy
annotation. To teach it, position the text cursor on the name of the field, type Alt+Enter and invoke the Suppress unused warning if annotated by '@FindBy'
action. After that it will no longer warn on any field annotated by this annotation.
The action will add the intention to an internal "Mark field as implicitly written if annotated by" list. The setting can also be found in the settings of the inspection by clicking on the Annotations...
button under the Entry points
tab.
To get rid of the warning you can add getter and setter for your fields.
public SelenideElement getOldPassword(){
return this.oldPassword;
}
public void setOldPassword(SelenideElement oldPassword){
this.oldPassword = oldPassword;
}