File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
src/test/java/org/scijava/util Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 3535import static org .junit .Assert .assertEquals ;
3636import static org .junit .Assert .assertNull ;
3737import static org .junit .Assert .assertSame ;
38+ import static org .junit .Assert .assertTrue ;
3839import static org .junit .Assert .fail ;
3940
4041import java .io .Serializable ;
4142import java .lang .reflect .Field ;
4243import java .lang .reflect .Type ;
44+ import java .lang .reflect .TypeVariable ;
4345import java .util .HashMap ;
4446import java .util .List ;
4547
@@ -180,6 +182,16 @@ public void testRaws() {
180182 Serializable .class , Cloneable .class );
181183 }
182184
185+ /** Tests {@link Types#field}. */
186+ @ Test
187+ public void testField () {
188+ final Field field = Types .field (Thing .class , "thing" );
189+ assertEquals ("thing" , field .getName ());
190+ assertSame (Object .class , field .getType ());
191+ assertTrue (field .getGenericType () instanceof TypeVariable );
192+ assertEquals ("T" , ((TypeVariable <?>) field .getGenericType ()).getName ());
193+ }
194+
183195 /** Tests {@link Types#array}. */
184196 @ Test
185197 public void testArray () {
You can’t perform that action at this time.
0 commit comments