### Question:
ConfigWriter { public ConfigWriter( SchemaManager schemaManager, ConfigBean configBean ) { this.schemaManager = schemaManager; this.configBean = configBean; } ConfigWriter( SchemaManager schemaManager, ConfigBean configBean ); void writeToPath( String path ); void writeToFile( File file ); String writeToString(); List<LdifEntry> getConvertedLdifEntries();  }### Answer:
@Test public void testConfigWriter() throws Exception { File configDir = new File( workDir, "configWriter" ); String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "config.ldif", true ); SingleFileLdifPartition configPartition = new SingleFileLdifPartition( schemaManager, dnFactory ); configPartition.setId( "config" ); configPartition.setPartitionPath( new File( configFile ).toURI() ); configPartition.setSuffixDn( new Dn( schemaManager, "ou=config" ) ); configPartition.setSchemaManager( schemaManager ); configPartition.initialize(); ConfigPartitionReader cpReader = new ConfigPartitionReader( configPartition ); ConfigBean configBean = cpReader.readConfig(); assertNotNull( configBean ); ConfigWriter configWriter = new ConfigWriter( schemaManager, configBean ); LdifReader ldifReader = new LdifReader( configFile ); List<LdifEntry> originalConfigEntries = new ArrayList<LdifEntry>(); while ( ldifReader.hasNext() ) { originalConfigEntries.add( ldifReader.next() ); } ldifReader.close(); List<LdifEntry> generatedConfigEntries = configWriter.getConvertedLdifEntries(); assertEquals( originalConfigEntries.size(), generatedConfigEntries.size() ); Comparator<LdifEntry> dnComparator = new Comparator<LdifEntry>() { public int compare( LdifEntry o1, LdifEntry o2 ) { return o1.getDn().toString().compareToIgnoreCase( o2.getDn().toString() ); } }; Collections.sort( originalConfigEntries, dnComparator ); Collections.sort( generatedConfigEntries, dnComparator ); for ( int i = 0; i < originalConfigEntries.size(); i++ ) { Entry originalConfigEntry = originalConfigEntries.get( i ).getEntry(); Entry generatedConfigEntry = generatedConfigEntries.get( i ).getEntry(); assertTrue( originalConfigEntry.getDn().equals( generatedConfigEntry.getDn() ) ); } configPartition.destroy( configPartition.beginReadTransaction() ); }