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

@Test
public void testNestedTupleGenerics2() {
	RichMapFunction<?, ?> function = new RichMapFunction<Nested2<Boolean>, Nested2<Boolean>>() {
		private static final long serialVersionUID = 1L;
		@Override
		public Nested2<Boolean> map(Nested2<Boolean> value) throws Exception {
			return null;
		}
	};
	
	TypeInformation<?> ti = TypeExtractor.getMapReturnTypes(function, (TypeInformation) TypeInfoParser.parse("Tuple2<Boolean, Tuple2<Tuple2<Integer, Tuple2<Boolean, Boolean>>, Tuple2<Integer, Tuple2<Boolean, Boolean>>>>"));
	// Should be 
	// Tuple2<Boolean, Tuple2<Tuple2<Integer, Tuple2<Boolean, Boolean>>, Tuple2<Integer, Tuple2<Boolean, Boolean>>>>
	// 1st nested level
	Assert.assertTrue(ti.isTupleType());
	Assert.assertEquals(2, ti.getArity());
	TupleTypeInfo<?> tti = (TupleTypeInfo<?>) ti;
	Assert.assertEquals(BasicTypeInfo.BOOLEAN_TYPE_INFO, tti.getTypeAt(0));
	Assert.assertTrue(tti.getTypeAt(1).isTupleType());
	// 2nd nested level
	TupleTypeInfo<?> tti2 = (TupleTypeInfo<?>) tti.getTypeAt(1);
	Assert.assertTrue(tti2.getTypeAt(0).isTupleType());
	Assert.assertTrue(tti2.getTypeAt(1).isTupleType());
	// 3rd nested level
	TupleTypeInfo<?> tti3 = (TupleTypeInfo<?>) tti2.getTypeAt(0);
	Assert.assertEquals(BasicTypeInfo.INT_TYPE_INFO, tti3.getTypeAt(0));
	Assert.assertTrue(tti3.getTypeAt(1).isTupleType());
	// 4th nested level
	TupleTypeInfo<?> tti4 = (TupleTypeInfo<?>) tti3.getTypeAt(1);
	Assert.assertEquals(BasicTypeInfo.BOOLEAN_TYPE_INFO, tti4.getTypeAt(0));
	Assert.assertEquals(BasicTypeInfo.BOOLEAN_TYPE_INFO, tti4.getTypeAt(1));
}