"adrian(a)jboss.org" wrote : "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.
|
Ok, for MetaData there is no problem.
What do we do with JavaBeans (which now fail - since with wildcard test's we use plain
java.lang.Object)?
anonymous wrote :
| 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 expectedType.cast(o);
| | }
| | catch (ClassCastException e)
| | {
| | fail("Object " + o + " of class " +
o.getClass().getName() + " is not an instanceof " + expectedType.getName());
| | }
| | }
| |
Cool.
I added this code to test project.
Will use it in MC once I update test snapshot.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4005296#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...