Skip to content

Commit 9a76267

Browse files
author
joeretro
committed
Renamed isNull() -> nullValue(), isNotNull() -> notNullValue(). Could not use null() because it's a keyword.
1 parent e0e80d5 commit 9a76267

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

src/library/org/hamcrest/core/IsNull.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,20 @@ public void describeTo(Description description) {
2020
description.appendText("null");
2121
}
2222

23+
/**
24+
* Matches if value is null.
25+
*/
2326
@Factory
24-
public static <T> Matcher<T> isNull() {
27+
public static <T> Matcher<T> nullValue() {
2528
return new IsNull<T>();
2629
}
2730

31+
/**
32+
* Matches if value is not null.
33+
*/
2834
@Factory
29-
public static <T> Matcher<T> isNotNull() {
30-
return not(IsNull.<T>isNull());
35+
public static <T> Matcher<T> notNullValue() {
36+
return not(IsNull.<T>nullValue());
3137
}
3238
}
3339

src/unit-test/org/hamcrest/core/IsNullTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66
import org.hamcrest.AbstractMatcherTest;
77
import org.hamcrest.Matcher;
88
import static org.hamcrest.MatcherAssert.assertThat;
9-
import static org.hamcrest.core.IsNull.isNull;
10-
import static org.hamcrest.core.IsNull.isNotNull;
9+
import static org.hamcrest.core.IsNull.nullValue;
10+
import static org.hamcrest.core.IsNull.notNullValue;
1111

1212
public class IsNullTest extends AbstractMatcherTest {
1313

1414
protected Matcher<?> createMatcher() {
15-
return isNull();
15+
return nullValue();
1616
}
1717

1818
public void testEvaluatesToTrueIfArgumentIsNull() {
19-
assertThat(null, isNull());
20-
assertThat(ANY_NON_NULL_ARGUMENT, not(isNull()));
19+
assertThat(null, nullValue());
20+
assertThat(ANY_NON_NULL_ARGUMENT, not(nullValue()));
2121

22-
assertThat(ANY_NON_NULL_ARGUMENT, isNotNull());
23-
assertThat(null, not(isNotNull()));
22+
assertThat(ANY_NON_NULL_ARGUMENT, notNullValue());
23+
assertThat(null, not(notNullValue()));
2424
}
2525
}

0 commit comments

Comments
 (0)