File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed
library/org/hamcrest/core
unit-test/org/hamcrest/core Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -20,14 +20,20 @@ public void describeTo(Description description) {
20
20
description .appendText ("null" );
21
21
}
22
22
23
+ /**
24
+ * Matches if value is null.
25
+ */
23
26
@ Factory
24
- public static <T > Matcher <T > isNull () {
27
+ public static <T > Matcher <T > nullValue () {
25
28
return new IsNull <T >();
26
29
}
27
30
31
+ /**
32
+ * Matches if value is not null.
33
+ */
28
34
@ 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 ());
31
37
}
32
38
}
33
39
Original file line number Diff line number Diff line change 6
6
import org .hamcrest .AbstractMatcherTest ;
7
7
import org .hamcrest .Matcher ;
8
8
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 ;
11
11
12
12
public class IsNullTest extends AbstractMatcherTest {
13
13
14
14
protected Matcher <?> createMatcher () {
15
- return isNull ();
15
+ return nullValue ();
16
16
}
17
17
18
18
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 ()));
21
21
22
- assertThat (ANY_NON_NULL_ARGUMENT , isNotNull ());
23
- assertThat (null , not (isNotNull ()));
22
+ assertThat (ANY_NON_NULL_ARGUMENT , notNullValue ());
23
+ assertThat (null , not (notNullValue ()));
24
24
}
25
25
}
You can’t perform that action at this time.
0 commit comments