This commit is contained in:
Zoltan Haindrich 2023-10-05 08:25:48 +00:00
parent e376ae901c
commit 1acd53b95d
1 changed files with 14 additions and 0 deletions

View File

@ -20,6 +20,7 @@
package org.apache.druid.common.config;
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.segment.column.ValueType;
import org.apache.druid.segment.data.ListIndexed;
import org.apache.druid.testing.InitializedNullHandlingTest;
import org.junit.Assert;
@ -27,6 +28,8 @@ import org.junit.Test;
import java.util.Collections;
import static org.apache.druid.common.config.NullHandling.defaultValueForClass;
import static org.apache.druid.common.config.NullHandling.defaultValueForType;
import static org.apache.druid.common.config.NullHandling.replaceWithDefault;
import static org.junit.Assert.assertEquals;
@ -89,6 +92,17 @@ public final class NullHandlingTest extends InitializedNullHandlingTest
Assert.assertNull(NullHandling.defaultValueForClass(Object.class));
}
@Test
public void test_defaultValueForType()
{
assertEquals(defaultValueForClass(Float.class), defaultValueForType(ValueType.FLOAT));
assertEquals(defaultValueForClass(Double.class), defaultValueForType(ValueType.DOUBLE));
assertEquals(defaultValueForClass(Long.class), defaultValueForType(ValueType.LONG));
assertEquals(defaultValueForClass(String.class), defaultValueForType(ValueType.STRING));
assertEquals(defaultValueForClass(Object.class), defaultValueForType(ValueType.COMPLEX));
assertEquals(defaultValueForClass(Object.class), defaultValueForType(ValueType.ARRAY));
}
@Test
public void test_ignoreNullsStrings()
{