aljoscha commented on a change in pull request #9976: [FLINK-14493][core] 
Introduce data types to ConfigOptions.
URL: https://github.com/apache/flink/pull/9976#discussion_r338026494
 
 

 ##########
 File path: 
flink-core/src/test/java/org/apache/flink/configuration/ConfigurationConversionsTest.java
 ##########
 @@ -0,0 +1,260 @@
+/*
+ * 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.configuration;
+
+import org.hamcrest.Description;
+import org.hamcrest.Matcher;
+import org.hamcrest.TypeSafeMatcher;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import javax.annotation.Nullable;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Optional;
+import java.util.function.Function;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.startsWith;
+import static org.hamcrest.Matchers.closeTo;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Tests for {@link Configuration} conversion between types. Extracted from 
{@link ConfigurationTest}.
+ */
+@RunWith(Parameterized.class)
+public class ConfigurationConversionsTest {
+
+       private static final byte[] EMPTY_BYTES = new byte[0];
+       private static final long TOO_LONG = Integer.MAX_VALUE + 10L;
+       private static final double TOO_LONG_DOUBLE = Double.MAX_VALUE;
+
+       private Configuration pc;
+
+       @Before
+       public void init() {
+               pc = new Configuration();
+
+               pc.setInteger("int", 5);
+               pc.setLong("long", 15);
+               pc.setLong("too_long", TOO_LONG);
+               pc.setFloat("float", 2.1456775f);
+               pc.setDouble("double", Math.PI);
+               pc.setDouble("negative_double", -1.0);
+               pc.setDouble("zero", 0.0);
+               pc.setDouble("too_long_double", TOO_LONG_DOUBLE);
+               pc.setString("string", "42");
+               pc.setString("non_convertible_string", "bcdefg&&");
+               pc.setBoolean("boolean", true);
+       }
+
+       @Rule
+       public ExpectedException thrown = ExpectedException.none();
+
+       @Parameterized.Parameters
+       public static Collection<TestSpec> getSpecs() {
+               return Arrays.asList(
+                       // as integer
 
 Review comment:
   Should these be `from integer`, because this was originally set as `integer` 
and is now being accessed in various ways?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to