PropertyValidator { static Map<String, Object> filterConfigAdminProperties(Map<String, ?> map) { HashMap<String, Object> result = new HashMap<>(); if (map != null) { for (String key : map.keySet()) { if (Constants.SERVICE_PID.equals(key) || ConfigurationAdmin.SERVICE_FACTORYPID.equals(key) || ConfigurationAdmin.SERVICE_BUNDLELOCATION.equals(key)) { continue; } result.put(key, map.get(key)); } } return result; }    }
@Test public void testFilterConfigAdminProperties() throws Exception { Map<String, Object> map = new HashMap<>(); map.put(Constants.SERVICE_PID, "testPid"); map.put(ConfigurationAdmin.SERVICE_FACTORYPID, "factoryPid"); map.put(ConfigurationAdmin.SERVICE_BUNDLELOCATION, "bundleLocation"); assertThat(filterConfigAdminProperties(map).size(), is(0)); assertThat(filterConfigAdminProperties(null), notNullValue()); assertThat(filterConfigAdminProperties(null).size(), is(0)); }