File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
src/library/org/hamcrest/core Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
<!-- Core -->
4
4
<factory class =" org.hamcrest.core.Is" />
5
- <factory class =" org.hamcrest.core.AllOf" />
6
- <factory class =" org.hamcrest.core.AnyOf" />
7
5
<factory class =" org.hamcrest.core.IsNot" />
8
6
<factory class =" org.hamcrest.core.IsEqual" />
7
+ <factory class =" org.hamcrest.core.IsInstanceOf" />
8
+ <factory class =" org.hamcrest.core.AllOf" />
9
+ <factory class =" org.hamcrest.core.AnyOf" />
9
10
<factory class =" org.hamcrest.core.IsSame" />
10
11
<factory class =" org.hamcrest.core.IsAnything" />
11
12
<factory class =" org.hamcrest.core.IsNull" />
12
- <factory class =" org.hamcrest.core.IsInstanceOf" />
13
13
<factory class =" org.hamcrest.core.DescribedAs" />
14
14
15
15
<!-- Collection -->
Original file line number Diff line number Diff line change 1
1
package org .hamcrest .core ;
2
2
3
+ import static org .hamcrest .core .IsInstanceOf .instanceOf ;
3
4
import static org .hamcrest .core .IsEqual .equalTo ;
4
5
import org .hamcrest .Factory ;
5
6
import org .hamcrest .Matcher ;
@@ -53,5 +54,16 @@ public static <T> Matcher<T> is(T value) {
53
54
return is (equalTo (value ));
54
55
}
55
56
57
+ /**
58
+ * This is a shortcut to the frequently used is(instanceOf(SomeClass.class)).
59
+ *
60
+ * eg. assertThat(cheese, is(instanceOf(Cheddar.class)))
61
+ * vs assertThat(cheese, is(Cheddar.class))
62
+ */
63
+ @ Factory
64
+ public static <T > Matcher <T > is (Class <T > type ) {
65
+ return is (instanceOf (type ));
66
+ }
67
+
56
68
}
57
69
You can’t perform that action at this time.
0 commit comments