dawidwys commented on a change in pull request #7777: [FLINK-9964][table] Add a full RFC-compliant CSV table format factory URL: https://github.com/apache/flink/pull/7777#discussion_r258841502
########## File path: flink-formats/flink-csv/src/test/java/org/apache/flink/table/descriptors/CsvTest.java ########## @@ -0,0 +1,109 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.table.descriptors; + +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.table.api.Types; +import org.apache.flink.table.api.ValidationException; +import org.apache.flink.types.Row; + +import org.junit.Test; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Tests for the {@link Csv} descriptor. + */ +public class CsvTest extends DescriptorTestBase { + + private static final TypeInformation<Row> SCHEMA = Types.ROW( + new String[]{"a", "b", "c"}, + new TypeInformation[]{Types.STRING(), Types.INT(), Types.ROW( + new String[]{"a", "b", "c"}, + new TypeInformation[]{Types.STRING(), Types.INT(), Types.BOOLEAN()} + )} + ); + + @Test(expected = ValidationException.class) + public void testInvalidAllowComments() { + addPropertyAndVerify(descriptors().get(0), "format.allow-comments", "DDD"); + } + + @Test(expected = ValidationException.class) + public void testMissingSchema() { + removePropertyAndVerify(descriptors().get(0), "format.schema"); + } + + @Test(expected = ValidationException.class) + public void testDuplicateSchema() { + // we add an additional schema + addPropertyAndVerify(descriptors().get(1), "format.schema", "DDD"); Review comment: Could we substitute "DDD" with a valid schema? I think we can't be sure of the underlying reason for the exception (if it is additional schema or invalid schema). ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services