Timm0 commented on code in PR #29674:
URL: https://github.com/apache/flink/pull/29674#discussion_r4527669968


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/operations/SqlNodeToOperationSqlCreateOrAlterMaterializedTableConverterTest.java:
##########
@@ -654,26 +651,26 @@ void 
testCreateOrAlterMaterializedTableWithChangedStartMode(
 
     private static Collection<Arguments> startModeAlterCases() {
         return List.of(
+                Arguments.of("RESUME_OR_FROM_BEGINNING", 
StartMode.resumeOrFromBeginning()),

Review Comment:
   My intention here was to just check the contract between the new api and the 
old one. When parsing sql the old one is used and we just compare here that the 
expected outcome is equivalent to what the new API produces. 
   I also changed to the new API in the other test files.



##########
flink-table/flink-table-common/src/test/java/org/apache/flink/table/catalog/StartModeTest.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * 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.catalog;
+
+import org.apache.flink.table.api.ValidationException;
+import org.apache.flink.table.catalog.Interval.TimeUnit;
+
+import org.junit.jupiter.api.Test;
+
+import java.time.Duration;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+/** Tests for {@link StartMode}. */
+class StartModeTest {
+
+    @Test
+    void offsetMustBeAPositiveWholeNumberOfSecondsThatFitsAnInt() {
+        
assertThat(StartMode.fromNow(Duration.ofSeconds(Integer.MAX_VALUE)).getInterval())
+                .isEqualTo(Interval.of(Integer.MAX_VALUE, TimeUnit.SECOND));
+
+        assertThatThrownBy(() -> StartMode.fromNow(Duration.ZERO))
+                .isInstanceOf(ValidationException.class)
+                .hasMessage("The start mode offset must be positive, but was: 
PT0S.");
+        assertThatThrownBy(() -> 
StartMode.resumeOrFromNow(Duration.ofSeconds(-1)))
+                .isInstanceOf(ValidationException.class)
+                .hasMessage("The start mode offset must be positive, but was: 
PT-1S.");
+        assertThatThrownBy(() -> 
StartMode.resumeOrFromNow(Duration.ofMillis(1500)))
+                .isInstanceOf(ValidationException.class)
+                .hasMessage(
+                        "The start mode offset must be a whole number of 
seconds, but was: PT1.5S.");
+        assertThatThrownBy(() -> 
StartMode.fromNow(Duration.ofSeconds(Integer.MAX_VALUE + 1L)))
+                .isInstanceOf(ValidationException.class)
+                .hasMessage(
+                        "The start mode offset must be at most 2147483647 
seconds, but was: PT596523H14M8S.");
+    }

Review Comment:
   Done



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to