Dunno how this slipped by us for so long:
| protected <T> T assertInstanceOf(Object o, Class<T> expectedType,
boolean allowNull)
| {
| if (expectedType == null)
| fail("Null expectedType");
|
| if (o == null && allowNull)
| return null;
|
| try
| {
| return expectedType.cast(o);
| }
| catch (ClassCastException e)
| {
| fail("Object " + o + " of class " +
o.getClass().getName() + " is not an instanceof " + expectedType.getName());
| // should not reach this
| return null;
| }
| }
|
What about if allowNull == false and o == null? :-(
A test for test required. :-)
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4137790#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...