### Question:
DBChannelCfgMonitor { public String buildDatabaseConnectString(Set<String> dbChannelCfgs) { if (dbChannelCfgs == null || dbChannelCfgs.isEmpty()) return ""; StringBuffer sb = new StringBuffer(); dbChannelCfgs.forEach(s -> sb.append(s).append(",")); return sb.substring(0, sb.length() - 1); }  static DBChannelCfgMonitor getInstance(); void tryLoadAndRestart(String additionalConfigFile); void initDispatchers(); Set<String> getAllCfgs(String additionalConfigFile); String buildDatabaseConnectString(Set<String> dbChannelCfgs);  }### Answer:
@Test public void testBuildDatabaseConnectString() throws Exception { Set<String> testSet = new HashSet<>(); testSet.add("abc_group"); testSet.add("group_abc"); testSet.add("abc_group__sub__"); testSet.add("__abc_group__"); String result = DBChannelCfgMonitor.getInstance().buildDatabaseConnectString(testSet); assertTrue(result.contains("abc_group")); assertTrue(result.contains("group_abc")); assertTrue(result.contains("abc_group__sub__")); assertTrue(result.contains("__abc_group__")); assertFalse(result.contains("__abc_group__1")); assertFalse(result.contains("1__abc_group__")); assertFalse(result.contains("1__abc_2group__")); System.out.println(result); String emptryResult = DBChannelCfgMonitor.getInstance().buildDatabaseConnectString(new HashSet<>()); assertTrue(emptryResult.isEmpty()); Set<String> nullSet = null; String nullResult = DBChannelCfgMonitor.getInstance().buildDatabaseConnectString(nullSet); assertTrue(nullResult.isEmpty()); }