"alesj" wrote :
| So if our returned MetaData is non-Serializable, we should throw exception (since we
want all our MD to be serializable, right?)?
|
Correct.
This is a candidate for AbstractTestCase in the jboss-test project.
| /**
| * Check we have the expected type
| *
| * @param <T> the expected type
| * @param o the object
| * @param expectedType the excepted class of the exception
| * @return the expected type
| */
| protected <T> T assertInstanceOf(Object o, Class<T> expectedType)
| {
| return assertInstanceOf(o, expectedType, true);
| }
|
| /**
| * Check we have the expected type
| *
| * @param <T> the expected type
| * @param o the object
| * @param expectedType the excepted class of the exception
| * @param allowNull whether the object can be null
| * @return the expected type
| */
| 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 expected.cast(o);
| }
| catch (ClassCastException e)
| {
| fail("Object " + o + " of class " +
o.getClass().getName() + " is not an instanceof " + expectedType.getName());
| }
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4005260#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...