ModuleRepositoriesContentHandler { public String toString(final ModuleRepositories repositories) { if (repositories == null) { return ""; } return createXStream().toXML(repositories); } ModuleRepositoriesContentHandler(); String toString(final ModuleRepositories repositories); ModuleRepositories toModel(final String text);  }
@Test public void testNullModel() throws Exception { final String xml = handler.toString(null); assertEquals("", xml); }
@Test public void testEmptyRepositories() throws Exception { final String xml = handler.toString(new ModuleRepositories()); assertEquals("<project-repositories>\n" + " <repositories/>\n" + "</project-repositories>", xml); }
@Test public void testRepositoriesMarshalling() throws Exception { final Set<ModuleRepositories.ModuleRepository> repositories = new HashSet<ModuleRepositories.ModuleRepository>(); repositories.add(new ModuleRepositories.ModuleRepository(true, new MavenRepositoryMetadata("id", "url", MavenRepositorySource.LOCAL))); final ModuleRepositories moduleRepositories = new ModuleRepositories(repositories); final String xml = handler.toString(moduleRepositories); assertEquals("<project-repositories>\n" + " <repositories>\n" + " <repository>\n" + " <include>true</include>\n" + " <metadata>\n" + " <id>id</id>\n" + " <url>url</url>\n" + " <source>LOCAL</source>\n" + " </metadata>\n" + " </repository>\n" + " </repositories>\n" + "</project-repositories>", xml); }