### Question:
YamlFactory { public static Yaml newYaml() { PropertyUtils propertyUtils = new AdvancedPropertyUtils(); propertyUtils.setSkipMissingProperties(true); propertyUtils.setAllowReadOnlyProperties(false); Constructor constructor = new Constructor(); Representer representer = new AdvancedRepresenter(); representer.setPropertyUtils(propertyUtils); representer.addClassTag(CircusTrainConfig.class, Tag.MAP); DumperOptions dumperOptions = new DumperOptions(); dumperOptions.setIndent(2); dumperOptions.setDefaultFlowStyle(FlowStyle.BLOCK); dumperOptions.setAllowReadOnlyProperties(true); return new Yaml(constructor, representer, dumperOptions); } private  YamlFactory(); static Yaml newYaml();  }### Answer:
@Test public void typical() { String expectedYaml = new StringBuffer() .append("replica-catalog:\n") .append(" hive-metastore-uris: replicaMetaStoreUri\n") .append(" name: replica\n") .append("source-catalog:\n") .append(" disable-snapshots: false\n") .append(" hive-metastore-uris: sourceMetaStoreUri\n") .append(" name: source\n") .append("table-replications:\n") .append("- orphaned-data-strategy: HOUSEKEEPING\n") .append(" partition-fetcher-buffer-size: 1000\n") .append(" partition-iterator-batch-size: 1000\n") .append(" qualified-replica-name: replicadatabasename.replicatablename\n") .append(" replica-database-name: replicadatabasename\n") .append(" replica-table:\n") .append(" database-name: replicaDatabaseName\n") .append(" table-location: replicaTableLocation\n") .append(" table-name: replicaTableName\n") .append(" replica-table-name: replicatablename\n") .append(" replication-mode: FULL\n") .append(" replication-strategy: UPSERT\n") .append(" source-table:\n") .append(" database-name: databaseName\n") .append(" generate-partition-filter: true\n") .append(" partition-limit: 32767\n") .append(" qualified-name: databasename.tablename\n") .append(" table-name: tableName\n") .toString(); StringWriter sw = new StringWriter(); CircusTrainConfig circusTrainConfig = CircusTrainConfig .builder() .sourceMetaStoreUri("sourceMetaStoreUri") .replicaMetaStoreUri("replicaMetaStoreUri") .replication(ReplicationMode.FULL, "databaseName", "tableName", "replicaDatabaseName", "replicaTableName", "replicaTableLocation", OrphanedDataStrategy.HOUSEKEEPING) .build(); Yaml yaml = YamlFactory.newYaml(); yaml.dump(circusTrainConfig, sw); assertThat(sw.toString()).isEqualTo(expectedYaml); }