[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: SpecialValueFactoryUnitTestCase failure
adrian@jboss.org
do-not-reply at jboss.com
Fri Feb 22 10:52:57 EST 2008
I would update the test to this:
| public Map<String, String> compositeSignature;
|
| public void testMapComposite() throws Exception
| {
| Field field = getClass().getField("compositeSignature");
| Type mapSignature = field.getGenericType();
| CompositeMetaType result = assertInstanceOf(resolve(mapSignature), CompositeMetaType.class);
| MutableCompositeMetaType expected = new MutableCompositeMetaType(HashMap.class.getName(), "HashMap<String,String>");
| expected.addItem("key1", "key1", SimpleMetaType.STRING);
| expected.addItem("key2", "key2", SimpleMetaType.STRING);
| expected.addItem("key3", "key3", SimpleMetaType.STRING);
| expected.freeze();
|
| testComposite(expected, result);
|
| String[] itemNames = {"key1", "key2", "key3"};
| MetaValue[] itemValues = {SimpleValueSupport.wrap("value1"), SimpleValueSupport.wrap("value3"), SimpleValueSupport.wrap("value3")};
| CompositeValueSupport mapValue = new CompositeValueSupport(expected, itemNames, itemValues);
| assertEquals("value1", mapValue.get("key1"));
| }
|
Your test will never work, since:
| new HashMap<String,String>().getClass()
|
will just return the erased type, not the generic type.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4131470#4131470
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4131470
More information about the jboss-dev-forums
mailing list