Question about item testing for NULL

Hello,
If I test an item id it is initialised or notwhat is the correct and best way?

Example

Switch Testswitch


Rule "testing"
When
(Sth)
Then
If (Testswitch ==NULL || Testswitch == UNDEF)
.....
End

Or

Rule "testing"
When
(Sth)
Then
If (Testswitch.state ==NULL || Testswitch.state == UNDEF)
.....
end

??

https://openhab-scripters.github.io/openhab-helper-libraries/Guides/But%20How%20Do%20I.html#stop-a-rule-if-the-triggering-item-s-state-is-null-or-undef

Thanks helped me a lot

1 Like