refactor: drop unused standalone comicinfo.xml parser (#218)

This commit is contained in:
James Ward
2026-04-22 17:26:54 -04:00
committed by Zach Yale
parent 052c9323be
commit 66de45c4be
2 changed files with 0 additions and 117 deletions
@@ -1143,70 +1143,6 @@ class CbxMetadataExtractorTest {
}
}
@Nested
class ExtractFromComicInfoXml {
@Test
void throwsForNullFile() {
assertThatThrownBy(() -> extractor.extractFromComicInfoXml(null))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("XML file cannot be null");
}
@Test
void extractsMetadataFromStandaloneXml() throws IOException {
String xml = wrapInComicInfo("""
<Title>Standalone Comic</Title>
<Writer>Grant Morrison</Writer>
<Publisher>DC Comics</Publisher>
""");
Path xmlPath = tempDir.resolve("mycomic");
Files.createDirectories(xmlPath);
Path xmlFile = xmlPath.resolve("ComicInfo.xml");
Files.writeString(xmlFile, xml);
BookMetadata metadata = extractor.extractFromComicInfoXml(xmlFile.toFile());
assertThat(metadata.getTitle()).isEqualTo("Standalone Comic");
assertThat(metadata.getAuthors()).containsExactly("Grant Morrison");
assertThat(metadata.getPublisher()).isEqualTo("DC Comics");
}
@Test
void usesParentDirectoryAsFallbackTitle() throws IOException {
String xml = wrapInComicInfo("<Publisher>Marvel</Publisher>");
Path comicDir = tempDir.resolve("Batman - Year One (2005)");
Files.createDirectories(comicDir);
Path xmlFile = comicDir.resolve("ComicInfo.xml");
Files.writeString(xmlFile, xml);
BookMetadata metadata = extractor.extractFromComicInfoXml(xmlFile.toFile());
assertThat(metadata.getTitle()).isEqualTo("Batman - Year One (2005)");
}
@Test
void handlesNonExistentFile() {
File nonExistent = tempDir.resolve("does_not_exist.xml").toFile();
BookMetadata metadata = extractor.extractFromComicInfoXml(nonExistent);
assertThat(metadata).isNotNull();
assertThat(metadata.getTitle()).isNotNull();
}
@Test
void handlesMalformedXml() throws IOException {
Path xmlFile = tempDir.resolve("bad.xml");
Files.writeString(xmlFile, "<ComicInfo><Title>Unclosed");
BookMetadata metadata = extractor.extractFromComicInfoXml(xmlFile.toFile());
assertThat(metadata).isNotNull();
assertThat(metadata.getTitle()).isNotNull();
}
}
@Nested
class ComicInfoCaseInsensitive {