SofaRegistryHelper { static String getValue(Map<String, String> map, String... keys) { if (CommonUtils.isEmpty(map)) { return null; } for (String key : keys) { String val = map.get(key); if (val != null) { return val; } } return null; }  static String buildListDataId(AbstractInterfaceConfig config, String protocol); static String convertProviderToUrls(ProviderConfig providerConfig, ServerConfig server); static List<ProviderInfo> parseProviderInfos(List<String> urls); static ProviderInfo parseProviderInfo(String originUrl); static final String PUBLISHER_PREFIX; static final String SUBSCRIBER_PREFIX; static final String SUBSCRIBER_LIST_GROUP_ID; static final String SUBSCRIBER_CONFIG_GROUP_ID; static final String PROTOCOL_TYPE_OVERRIDE; }
@Test public void getValue() throws Exception { SofaRegistryHelper.getValue(null); SofaRegistryHelper.getValue(null, null); Map<String, String> map = new HashMap<String, String>(); Assert.assertEquals(SofaRegistryHelper.getValue(map, "xx"), null); map.put("11", "aa"); map.put("22", "bb"); map.put("33", "cc"); Assert.assertEquals(SofaRegistryHelper.getValue(map), null); Assert.assertEquals(SofaRegistryHelper.getValue(map, "xx"), null); Assert.assertEquals(SofaRegistryHelper.getValue(map, "yy", "zz"), null); Assert.assertEquals(SofaRegistryHelper.getValue(map, "zz", "11"), "aa"); Assert.assertEquals(SofaRegistryHelper.getValue(map, "11", "22"), "aa"); Assert.assertEquals(SofaRegistryHelper.getValue(map, "22", "33"), "bb"); }