This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch camel-3.14.x in repository https://gitbox.apache.org/repos/asf/camel.git
commit 5f4f94cb80d30b1896bef29aec76b26f5b452f8e Author: Claus Ibsen <[email protected]> AuthorDate: Thu Feb 17 13:54:59 2022 +0100 CAMEL-17658: Added unit test --- .../PropertyBindingSupportMapKeyWithDotTest.java | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportMapKeyWithDotTest.java b/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportMapKeyWithDotTest.java new file mode 100644 index 0000000..64a80fd --- /dev/null +++ b/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportMapKeyWithDotTest.java @@ -0,0 +1,48 @@ +/* + * 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.camel.support; + +import org.apache.camel.ContextTestSupport; +import org.junit.jupiter.api.Test; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Unit test for PropertyBindingSupport + */ +public class PropertyBindingSupportMapKeyWithDotTest extends ContextTestSupport { + + @Test + public void testPropertiesMap() throws Exception { + Map<String, Object> prop = new LinkedHashMap<>(); + prop.put("id", "123"); + prop.put("database.name", "MySQL"); + prop.put("database.timezone", "CET"); + + Map<String, String> map = new HashMap<>(); + PropertyBindingSupport.build().bind(context, map, prop); + + assertEquals("123", map.get("id")); + assertEquals("MySQL", map.get("database.name")); + assertEquals("CET", map.get("database.timezone")); + } + +}
