### Question:
BoundSql { public boolean hasAdditionalParameter(String name) { String paramName = new PropertyTokenizer(name).getName(); return additionalParameters.containsKey(paramName); } BoundSql(Configuration configuration, String sql, List<ParameterMapping> parameterMappings, Object parameterObject); String getSql(); List<ParameterMapping> getParameterMappings(); Object getParameterObject(); boolean hasAdditionalParameter(String name); void setAdditionalParameter(String name, Object value); Object getAdditionalParameter(String name);  }### Answer:
@Test public void testHasAdditionalParameter() throws Exception { List<ParameterMapping> params = Collections.emptyList(); BoundSql boundSql = new BoundSql(new Configuration(), "some sql", params, new Object()); Map<String, String> map = new HashMap<String, String>(); map.put("key1", "value1"); boundSql.setAdditionalParameter("map", map); Person bean = new Person(); bean.id = 1; boundSql.setAdditionalParameter("person", bean); String[] array = new String[] {"User1", "User2"}; boundSql.setAdditionalParameter("array", array); assertFalse(boundSql.hasAdditionalParameter("pet")); assertFalse(boundSql.hasAdditionalParameter("pet.name")); assertTrue(boundSql.hasAdditionalParameter("map")); assertTrue(boundSql.hasAdditionalParameter("map.key1")); assertTrue("should return true even if the child property does not exists.", boundSql.hasAdditionalParameter("map.key2")); assertTrue(boundSql.hasAdditionalParameter("person")); assertTrue(boundSql.hasAdditionalParameter("person.id")); assertTrue("should return true even if the child property does not exists.", boundSql.hasAdditionalParameter("person.name")); assertTrue(boundSql.hasAdditionalParameter("array[0]")); assertTrue("should return true even if the element does not exists.", boundSql.hasAdditionalParameter("array[99]")); }
@Test void testHasAdditionalParameter() { List<ParameterMapping> params = Collections.emptyList(); BoundSql boundSql = new BoundSql(new Configuration(), "some sql", params, new Object()); Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); boundSql.setAdditionalParameter("map", map); Person bean = new Person(); bean.id = 1; boundSql.setAdditionalParameter("person", bean); String[] array = new String[]{"User1", "User2"}; boundSql.setAdditionalParameter("array", array); assertFalse(boundSql.hasAdditionalParameter("pet")); assertFalse(boundSql.hasAdditionalParameter("pet.name")); assertTrue(boundSql.hasAdditionalParameter("map")); assertTrue(boundSql.hasAdditionalParameter("map.key1")); assertTrue(boundSql.hasAdditionalParameter("map.key2"), "should return true even if the child property does not exists."); assertTrue(boundSql.hasAdditionalParameter("person")); assertTrue(boundSql.hasAdditionalParameter("person.id")); assertTrue(boundSql.hasAdditionalParameter("person.name"), "should return true even if the child property does not exists."); assertTrue(boundSql.hasAdditionalParameter("array[0]")); assertTrue(boundSql.hasAdditionalParameter("array[99]"), "should return true even if the element does not exists."); }