### Question:
ClusterConfig { protected ClusterProperties getClusterProperties() { String keyPrefix = "yfs.gateway."; ClusterProperties clusterProperties = new ClusterProperties(); Map<String, String> map = PropertiesUtil.getProperty("cluster.properties"); Set<Integer> nodeIds = new HashSet<>(); map.entrySet().stream().forEach(entry -> { String key = entry.getKey(); String regex = ".*\\[(\\d)\\].*"; Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(key); if (matcher.matches()) { int index = Integer.valueOf(matcher.group(1)); nodeIds.add(index); } }); for (int i = 0; i < nodeIds.size(); i++) { if (!nodeIds.contains(i)) { throw new RuntimeException("node id need to correct!"); } } for (int i = 0; i < nodeIds.size(); i++) { clusterProperties.getNode().add(new ClusterProperties.ClusterNode()); } Arrays.stream(ClusterProperties.class.getDeclaredFields()).forEach(field1 -> { if (field1.getType().getName().endsWith("String")) { try { field1.set(clusterProperties, map.get(keyPrefix + field1.getName())); } catch (IllegalAccessException e) { e.printStackTrace(); } } if (field1.getType().getName().endsWith("long")) { try { field1.set(clusterProperties, Long.valueOf(map.get(keyPrefix + field1.getName()))); } catch (IllegalAccessException e) { e.printStackTrace(); } } if (field1.getType().getName().endsWith("List")) { try { List<ClusterProperties.ClusterNode> clusterNodeList = (List<ClusterProperties.ClusterNode>) field1.get(clusterProperties); for (int i = 0; i < clusterNodeList.size(); i++) { for (Field field2 : ClusterProperties.ClusterNode.class.getFields()) { if (field2.getType().getName().endsWith("String")) { field2.set(clusterNodeList.get(i), map.get(keyPrefix + field1.getName() + "[" + i + "]." + field2.getName())); } else if (field2.getType().getName().endsWith("int")) { field2.set(clusterNodeList.get(i), Integer.valueOf(map.get(keyPrefix + field1.getName() + "[" + i + "]." + field2.getName()))); } } } } catch (IllegalAccessException e) { throw new RuntimeException(e); } } }); return clusterProperties; } ClusterConfig();  public ClusterProperties clusterProperties; public Atomix atomix; public AtomicMap<String, StoreInfo> atomicMap; }### Answer:
@Test public void test() { ClusterProperties clusterProperties = new ClusterConfig().getClusterProperties(); Assert.assertEquals("server1", clusterProperties.getLocal()); Assert.assertEquals("yfs-gateway/data/metadata", clusterProperties.getMetadataDir()); Assert.assertEquals(6003, clusterProperties.getNode().get(2).getSocket_port()); }