@PublicEvolving
    public static <IN, OUT> TypeInformation<OUT> getMapReturnTypes(
            MapFunction<IN, OUT> mapInterface, TypeInformation<IN> inType) {
        return getMapReturnTypes(mapInterface, inType, null, false);
    }
@SuppressWarnings({"rawtypes", "unchecked"})
    @Test
    void testInputMismatchExceptions() {

        RichMapFunction<?, ?> function =
                new RichMapFunction<Tuple2<String, String>, String>() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public String map(Tuple2<String, String> value) throws Exception {
                        return null;
                    }
                };

        assertThatThrownBy(
                        () ->
                                TypeExtractor.getMapReturnTypes(
                                        function,
                                        (TypeInformation)
                                                TypeInformation.of(
                                                        new TypeHint<
                                                                Tuple2<Integer, String>>() {})))
                .isInstanceOf(InvalidTypesException.class);

        assertThatThrownBy(
                        () ->
                                TypeExtractor.getMapReturnTypes(
                                        function,
                                        (TypeInformation)
                                                TypeInformation.of(
                                                        new TypeHint<
                                                                Tuple3<
                                                                        String,
                                                                        String,
                                                                        String>>() {})))
                .isInstanceOf(InvalidTypesException.class);

        RichMapFunction<?, ?> function2 =
                new RichMapFunction<StringValue, String>() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public String map(StringValue value) throws Exception {
                        return null;
                    }
                };

        assertThatThrownBy(
                        () ->
                                TypeExtractor.getMapReturnTypes(
                                        function2,
                                        (TypeInformation)
                                                TypeInformation.of(new TypeHint<IntValue>() {})))
                .isInstanceOf(InvalidTypesException.class);

        RichMapFunction<?, ?> function3 =
                new RichMapFunction<Tuple1<Integer>[], String>() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public String map(Tuple1<Integer>[] value) throws Exception {
                        return null;
                    }
                };

        assertThatThrownBy(
                        () ->
                                TypeExtractor.getMapReturnTypes(
                                        function3,
                                        (TypeInformation)
                                                TypeInformation.of(new TypeHint<Integer[]>() {})))
                .isInstanceOf(InvalidTypesException.class);
    }