jerqi commented on code in PR #199:
URL: https://github.com/apache/incubator-uniffle/pull/199#discussion_r962629516
##########
common/src/test/java/org/apache/uniffle/common/config/ConfigOptionTest.java:
##########
@@ -56,6 +56,34 @@ public void testSetKVWithStringTypeDirectly() {
assertFalse(conf.get(booleanConfig));
}
+ enum TestType {
+ TYPE_1,
+ TYPE_2,
+ }
+
+ @Test
+ public void testEnumType() {
+ final ConfigOption<TestType> enumConfigOption = ConfigOptions
+ .key("rss.enum")
+ .enumType(TestType.class)
+ .defaultValue(TestType.TYPE_1)
+ .withDescription("enum test");
+
+ RssBaseConf conf = new RssBaseConf();
+
+ // case1: default value
+ assertEquals(TestType.TYPE_1, conf.get(enumConfigOption));
+
+ // case2: return the user specified value
+ conf.set(enumConfigOption, TestType.TYPE_2);
+ assertEquals(TestType.TYPE_2, conf.get(enumConfigOption));
+
+ // case3: set enum val with string
+ conf = new RssBaseConf();
+ conf.setString("rss.enum", "TYPE_2");
+ assertEquals(TestType.TYPE_2, conf.get(enumConfigOption));
Review Comment:
Should we add a case about wrong type?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]