@SuppressWarnings({ "unchecked", "rawtypes" })

@Test
public void testNestedTupleGenerics() {
	RichMapFunction<?, ?> function = new RichMapFunction<Nested<String, Integer>, Nested<String, Integer>>() {
		private static final long serialVersionUID = 1L;
		@Override
		public Nested<String, Integer> map(Nested<String, Integer> value) throws Exception {
			return null;
		}
	};
	TypeInformation<?> ti = TypeExtractor.getMapReturnTypes(function, (TypeInformation) TypeInfoParser.parse("Tuple2<String, Tuple2<Integer, Integer>>"));
	Assert.assertTrue(ti.isTupleType());
	Assert.assertEquals(2, ti.getArity());
	
	TupleTypeInfo<?> tti = (TupleTypeInfo<?>) ti;
	Assert.assertEquals(Nested.class, tti.getTypeClass());
	
	Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tti.getTypeAt(0));
	Assert.assertTrue(tti.getTypeAt(1).isTupleType());
	Assert.assertEquals(2, tti.getTypeAt(1).getArity());
	// Nested
	TupleTypeInfo<?> tti2 = (TupleTypeInfo<?>) tti.getTypeAt(1);
	Assert.assertEquals(Tuple2.class, tti2.getTypeClass());
	Assert.assertEquals(BasicTypeInfo.INT_TYPE_INFO, tti2.getTypeAt(0));
	Assert.assertEquals(BasicTypeInfo.INT_TYPE_INFO, tti2.getTypeAt(1));
}