// assertEquals(new QName(tm.getEncodingStyleURI(), "doubles"), type.getSchemaType());
}
public void testBestMatch() throws Exception
{
XMLTypeCreator creator = new XMLTypeCreator();
creator.setNextCreator(new DefaultTypeCreator());
creator.setConfiguration(new Configuration());
tm = new CustomTypeMapping(new DefaultTypeMappingRegistry().createDefaultMappings());
creator.setTypeMapping(tm);
Method method = MyService1.class.getDeclaredMethod("getCollection", new Class[0]);
Type type = creator.createType(method, -1);
assertTrue("type is not a collection", type instanceof CollectionType);
assertEquals("unexpected collection return type for method " + method, Double.class, ((CollectionType)type).getComponentType().getTypeClass());
method = MyService1.class.getDeclaredMethod("getCollection", new Class[]{Integer.TYPE});
type = creator.createType(method, -1);
assertEquals("unexpected collection return type for method " + method, Float.class, ((CollectionType)type).getComponentType().getTypeClass());
type = creator.createType(method, 0);
// assertEquals(new QName("urn:foo:bar", "int"), type.getSchemaType());
method = MyService1.class.getDeclaredMethod("getCollectionForValues", new Class[]{Integer.TYPE, Collection.class});
type = creator.createType(method, -1);
assertEquals("unexpected collection return type for method " + method, Calendar.class, ((CollectionType)type).getComponentType().getTypeClass());
method = MyService1.class.getDeclaredMethod("getCollectionForValues", new Class[]{String.class, Collection.class});
type = creator.createType(method, -1);
assertEquals("unexpected collection return type for method " + method, BigDecimal.class, ((CollectionType)type).getComponentType().getTypeClass());
type = creator.createType(method, 1);
assertEquals("unexpected collection parameter type for method " + method, Date.class, ((CollectionType)type).getComponentType().getTypeClass());
try
{
creator.createType(method, 2);
fail("Expected exception when requesting type for non-existent parameter index");
}
catch(Exception ex)
{}
}