@@ -37,12 +37,31 @@ public void describeTo(Description buffer) {
3737 * For example:
3838 * <pre>assertThat("foo", isIn(Arrays.asList("bar", "foo")))</pre>
3939 *
40+ * @deprecated use is(in(...)) instead
41+ *
4042 * @param collection
4143 * the collection in which matching items must be found
4244 *
4345 */
46+ @ Deprecated
4447 @ Factory
4548 public static <T > Matcher <T > isIn (Collection <T > collection ) {
49+ return in (collection );
50+ }
51+
52+ /**
53+ * Creates a matcher that matches when the examined object is found within the
54+ * specified collection.
55+ * <p/>
56+ * For example:
57+ * <pre>assertThat("foo", is(in(Arrays.asList("bar", "foo"))))</pre>
58+ *
59+ * @param collection
60+ * the collection in which matching items must be found
61+ *
62+ */
63+ @ Factory
64+ public static <T > Matcher <T > in (Collection <T > collection ) {
4665 return new IsIn <T >(collection );
4766 }
4867
@@ -53,12 +72,31 @@ public static <T> Matcher<T> isIn(Collection<T> collection) {
5372 * For example:
5473 * <pre>assertThat("foo", isIn(new String[]{"bar", "foo"}))</pre>
5574 *
75+ * @deprecated use is(in(...)) instead
76+ *
5677 * @param elements
5778 * the array in which matching items must be found
5879 *
5980 */
81+ @ Deprecated
6082 @ Factory
6183 public static <T > Matcher <T > isIn (T [] elements ) {
84+ return in (elements );
85+ }
86+
87+ /**
88+ * Creates a matcher that matches when the examined object is found within the
89+ * specified array.
90+ * <p/>
91+ * For example:
92+ * <pre>assertThat("foo", is(in(new String[]{"bar", "foo"})))</pre>
93+ *
94+ * @param elements
95+ * the array in which matching items must be found
96+ *
97+ */
98+ @ Factory
99+ public static <T > Matcher <T > in (T [] elements ) {
62100 return new IsIn <T >(elements );
63101 }
64102
@@ -67,14 +105,33 @@ public static <T> Matcher<T> isIn(T[] elements) {
67105 * specified elements.
68106 * <p/>
69107 * For example:
70- * <pre>assertThat("foo", isIn("bar", "foo"))</pre>
71- *
108+ * <pre>assertThat("foo", isOneOf("bar", "foo"))</pre>
109+ *
110+ * @deprecated use is(oneOf(...)) instead
111+ *
72112 * @param elements
73113 * the elements amongst which matching items will be found
74114 *
75115 */
116+ @ Deprecated
76117 @ Factory
77118 public static <T > Matcher <T > isOneOf (T ... elements ) {
78- return isIn (elements );
119+ return oneOf (elements );
120+ }
121+
122+ /**
123+ * Creates a matcher that matches when the examined object is equal to one of the
124+ * specified elements.
125+ * <p/>
126+ * For example:
127+ * <pre>assertThat("foo", is(oneOf("bar", "foo")))</pre>
128+ *
129+ * @param elements
130+ * the elements amongst which matching items will be found
131+ *
132+ */
133+ @ Factory
134+ public static <T > Matcher <T > oneOf (T ... elements ) {
135+ return in (elements );
79136 }
80137}
0 commit comments