tillrohrmann commented on a change in pull request #9691: [FLINK-13965] Keep 
hasDeprecatedKeys and deprecatedKeys methods in ConfigOption and mark it with 
@Deprecated annotation
URL: https://github.com/apache/flink/pull/9691#discussion_r325500227
 
 

 ##########
 File path: 
flink-core/src/test/java/org/apache/flink/configuration/ConfigOptionTest.java
 ##########
 @@ -86,4 +87,32 @@ public void testDeprecationFlagForMixedAlternativeKeys() {
                assertThat(fallbackKeys, containsInAnyOrder("fallback1", 
"fallback2"));
                assertThat(deprecatedKeys, containsInAnyOrder("deprecated1", 
"deprecated2"));
        }
+
+       @Test
+       public void testDeprecationForDeprecatedKeys() {
+               String[] deprecatedKeys = new String[] { "deprecated1", 
"deprecated2" };
+               final ConfigOption<Integer> optionWithDeprecatedKeys = 
ConfigOptions
+                       .key("key")
+                       .defaultValue(0)
+                       .withDeprecatedKeys(deprecatedKeys)
+                       .withFallbackKeys("fallback1");
+
+               assertTrue(optionWithDeprecatedKeys.hasDeprecatedKeys());
+               int counter = 0;
+               for (final String deprecatedKey : 
optionWithDeprecatedKeys.deprecatedKeys()) {
+                       counter++;
+                       assertTrue(Arrays.stream(deprecatedKeys).anyMatch(item 
-> item.equals(deprecatedKey)));
+               }
+
+               assertEquals(2, counter);
+
+               final ConfigOption<Integer> optionWithFallbackKeys = 
ConfigOptions
+                       .key("key")
+                       .defaultValue(0)
+                       .withFallbackKeys("fallback1");
 
 Review comment:
   Let's split this test up into a separate one. It is usually better to have 
smaller and more targeted tests.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to