ShardingSphereYamlRepresenter extends Representer { @Override protected NodeTuple representJavaBeanProperty(final Object javaBean, final Property property, final Object propertyValue, final Tag customTag) { NodeTuple nodeTuple = super.representJavaBeanProperty(javaBean, property, propertyValue, customTag); for (ShardingSphereYamlTupleProcessor each : ShardingSphereServiceLoader.newServiceInstances(ShardingSphereYamlTupleProcessor.class)) { if (property.getName().equals(each.getTupleName())) { return each.process(nodeTuple); } } return new DefaultYamlTupleProcessor().process(nodeTuple); } ShardingSphereYamlRepresenter();   }
@Test public void assertRepresentJavaBeanProperty() throws IntrospectionException { ShardingSphereYamlRepresenter shardingSphereYamlRepresenter = new ShardingSphereYamlRepresenter(); DefaultYamlRepresenterFixture javaBean = new DefaultYamlRepresenterFixture(); PropertyDescriptor propertyDescriptor = new PropertyDescriptor("collection", DefaultYamlRepresenterFixture.class); MethodProperty methodProperty = new MethodProperty(propertyDescriptor); List<String> propertyValue = new ArrayList<>(2); propertyValue.add("value1"); propertyValue.add("value2"); NodeTuple actual = shardingSphereYamlRepresenter.representJavaBeanProperty(javaBean, methodProperty, propertyValue, null); List<Node> nodes = ((SequenceNode) actual.getValueNode()).getValue(); assertThat(nodes.size(), is(2)); assertTrue(nodes.stream().map(node -> ((ScalarNode) node).getValue()).collect(Collectors.toList()).containsAll(propertyValue)); }