public static <T> T loadWithSecrets(Map<String, Object> map, Class<T> clazz, SourceContext sourceContext) {
        return loadWithSecrets(map, clazz, secretName -> sourceContext.getSecret(secretName));
    }
@Test
    public void testDefaultValue() {

        // test required field.
        Assert.expectThrows(IllegalArgumentException.class,
                () -> IOConfigUtils.loadWithSecrets(new HashMap<>(), TestDefaultConfig.class, new TestSinkContext()));


        // test all default value.
        Map<String, Object> configMap = new HashMap<>();
        configMap.put("testRequired", "test");
        TestDefaultConfig testDefaultConfig =
                IOConfigUtils.loadWithSecrets(configMap, TestDefaultConfig.class, new TestSinkContext());
        // if there is default value for a required field and no value provided when load config,
        // it should not throw exception but use the default value.
        Assert.assertEquals(testDefaultConfig.getTestDefaultRequired(), "defaultRequired");
        Assert.assertEquals(testDefaultConfig.getDefaultStr(), "defaultStr");
        Assert.assertEquals(testDefaultConfig.isDefaultBool(), true);
        Assert.assertEquals(testDefaultConfig.getDefaultInt(), 100);
        Assert.assertEquals(testDefaultConfig.getDefaultLong(), 100);
        Assert.assertEquals(testDefaultConfig.getDefaultDouble(), 100.12,0.00001);
        Assert.assertEquals(testDefaultConfig.getDefaultFloat(), 100.10,0.00001);
        Assert.assertEquals(testDefaultConfig.getNoDefault(), 0);
    }