Skip to content

Instantly share code, notes, and snippets.

View georgeracu's full-sized avatar

George Racu georgeracu

View GitHub Profile
@georgeracu
georgeracu / null-pointer-check.java
Created October 17, 2022 06:35
Null pointer check in Java
public static boolean isExpectedValue(String other) {
return EXPECTED_VALUE.equals(other);
}
@ParameterizedTest(name = "Should return {1} when value is \"{0}\"")
@CsvSource({",'false'","'','false'","'boo','false'","'blah','true'"})
void shouldMatchExpectedValue(String otherValue, boolean expected) {
assertThat(App.isExpectedValue(otherValue)).isEqualTo(expected);
}

Keybase proof

I hereby claim:

  • I am georgeracu on github.
  • I am george_r (https://keybase.io/george_r) on keybase.
  • I have a public key ASADmtDDdkD4OMmE-CiGb1V17ecowmonYvvQdC5EYynpZgo

To claim this, I am signing this object: